Module: Resourced::Resource::ClassMethods
- Defined in:
- lib/resourced.rb
Instance Method Summary collapse
-
#[](model_class) ⇒ Object
Duplicate resource and set another model class.
-
#key(key_name = nil) ⇒ Object
Set primary key.
-
#model(model_class = nil) ⇒ Object
Set or get model class.
Instance Method Details
#[](model_class) ⇒ Object
Duplicate resource and set another model class
50 51 52 53 54 |
# File 'lib/resourced.rb', line 50 def [](model_class) klass = self.dup klass.instance_variable_set(:@model, model_class) klass end |
#key(key_name = nil) ⇒ Object
Set primary key
59 60 61 |
# File 'lib/resourced.rb', line 59 def key(key_name=nil) key_name ? @key = key_name.to_sym : @key end |
#model(model_class = nil) ⇒ Object
Set or get model class
43 44 45 |
# File 'lib/resourced.rb', line 43 def model(model_class=nil) model_class ? @model = model_class : @model end |