Module: RailsAdmin::Adapters::Mongoid::Extension::ClassMethods

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



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

def accepts_nested_attributes_for_with_rails_admin(*args)
  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