Method: ActiveCollection::MemberClass::ClassMethods#model
- Defined in:
- lib/active_collection/member_class.rb
#model(model_name) ⇒ Object
If the name of the class held by your collection cannot be derived from the name of the collection class (by removing the word Collection from the end of the collection class name) then use model to set it.
Example:
class WeirdNamedCollection
model "Normal"
end
This will use the class Normal to do counts and finds.
20 21 22 |
# File 'lib/active_collection/member_class.rb', line 20 def model(model_name) (@model_class_name = model_name) && @model_class = nil end |