Class: RailsAdmin::AbstractObject
- Inherits:
-
Object
- Object
- RailsAdmin::AbstractObject
- Defined in:
- lib/rails_admin/abstract_object.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
^^^^^ the unnecessary “to_s” above is a workaround for meta_where, see github.com/sferik/rails_admin/issues/374.
Instance Method Summary collapse
-
#initialize(object) ⇒ AbstractObject
constructor
A new instance of AbstractObject.
- #method_missing(name, *args, &block) ⇒ Object
- #save(options = { :validate => true }) ⇒ Object
- #set_attributes(attributes, role = nil) ⇒ Object
Constructor Details
#initialize(object) ⇒ AbstractObject
Returns a new instance of AbstractObject.
12 13 14 |
# File 'lib/rails_admin/abstract_object.rb', line 12 def initialize(object) self.object = object end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
20 21 22 |
# File 'lib/rails_admin/abstract_object.rb', line 20 def method_missing(name, *args, &block) self.object.send(name, *args, &block) end |
Instance Attribute Details
#object ⇒ Object
^^^^^ the unnecessary “to_s” above is a workaround for meta_where, see github.com/sferik/rails_admin/issues/374
10 11 12 |
# File 'lib/rails_admin/abstract_object.rb', line 10 def object @object end |
Instance Method Details
#save(options = { :validate => true }) ⇒ Object
24 25 26 |
# File 'lib/rails_admin/abstract_object.rb', line 24 def save( = { :validate => true }) object.save() end |
#set_attributes(attributes, role = nil) ⇒ Object
16 17 18 |
# File 'lib/rails_admin/abstract_object.rb', line 16 def set_attributes(attributes, role = nil) object.assign_attributes(attributes, :as => role) end |