Sha256: 3ca5d924f95afe76452015dc20328b808caf0440e72ceae1e5a6ac4feee4dbc5
Contents?: true
Size: 882 Bytes
Versions: 1
Compression:
Stored size: 882 Bytes
Contents
module RailsAdmin class AbstractObject # undef almost all of this class's methods so it will pass almost # everything through to its delegate using method_missing (below). instance_methods.each { |m| undef_method m unless m.to_s =~ /(^__|^send$|^object_id$)/ } # ^^^^^ # the unnecessary "to_s" above is a workaround for meta_where, see # https://github.com/sferik/rails_admin/issues/374 attr_accessor :object def initialize(object) self.object = object end def set_attributes(attributes, role = nil) object.assign_attributes(attributes, :as => role) end def method_missing(name, *args, &block) self.object.send(name, *args, &block) end def save(options = { :validate => true }) object.save(options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
elucid-rails_admin-0.0.1 | lib/rails_admin/abstract_object.rb |