Class: RailsAdmin::Adapters::ActiveRecord::AbstractObject
- Inherits:
-
Object
- Object
- RailsAdmin::Adapters::ActiveRecord::AbstractObject
- Defined in:
- lib/rails_admin/adapters/active_record/abstract_object.rb
Direct Known Subclasses
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.
14 15 16 |
# File 'lib/rails_admin/adapters/active_record/abstract_object.rb', line 14 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
26 27 28 |
# File 'lib/rails_admin/adapters/active_record/abstract_object.rb', line 26 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
12 13 14 |
# File 'lib/rails_admin/adapters/active_record/abstract_object.rb', line 12 def object @object end |
Instance Method Details
#save(options = { :validate => true }) ⇒ Object
22 23 24 |
# File 'lib/rails_admin/adapters/active_record/abstract_object.rb', line 22 def save( = { :validate => true }) object.save() end |
#set_attributes(attributes, role = nil) ⇒ Object
18 19 20 |
# File 'lib/rails_admin/adapters/active_record/abstract_object.rb', line 18 def set_attributes(attributes, role = nil) object.assign_attributes(attributes, :as => role) end |