Reputation: 681
I've seen several models define a static method
self.base_attributes
{
:object => []
}
end
and some other models define the static method
self.attributes
@@attributes = {}
end
What exactly is the difference between attributes and base attributes?
Upvotes: 6
Views: 103
Reputation: 2926
Well in your example without knowing more about the code, the self.attributes
method is using a class variable (@@attributes
), which means that you could add more attributes to it at run time.
Where as your base_attributes
is hard coded. I suspect you're seeing something like:
base_attributes.merge(attributes)
which is a way of defining default values perhaps.
Upvotes: 1