Module: RailsAdmin::Adapters::Mongoid::NestedAttributesExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/rails_admin/adapters/mongoid/extension.rb

Instance Method Summary collapse

Instance Method Details

#accepts_nested_attributes_for_with_rails_admin(*args) ⇒ Object

Mongoid accepts_nested_attributes_for does not store options in accessible scope, so we intercept the call and store it in instance variable which can be accessed from outside



36
37
38
39
40
41
42
43
44
# File 'lib/rails_admin/adapters/mongoid/extension.rb', line 36

def accepts_nested_attributes_for_with_rails_admin(*args)
  @nested_attributes_options = {}
  options = args.extract_options!
  args.each do |arg|
    @nested_attributes_options[arg.to_sym] = options.reverse_merge(:allow_destroy=>false, :update_only=>false)
  end
  args << options
  accepts_nested_attributes_for_without_rails_admin(*args)
end