I'm probably doing this wrong, so apologies if I'm being dumb.
I have a model offers which has_many images. I've setup the model like this
has_many :offer_images, dependent: :destroy, inverse_of: :image_offer
accepts_nested_attributes_for :offer_images, allow_destroy: true
attr_accessible :offer_images_attributes, allow_destroy: true
I also have my rails_admin initialiser setup like this
group :default do
field :title, :string
field :description, :text
field :offer_date, :date
field :offer_images do
group :tagging do
field :tag_list, :tag_list
field :brands, :has_and_belongs_to_many_association do
This gives me the Offer Images option with 'Add New' button, however when I press the 'Add New' button it show 2 offer_image fields, and if I press the 'Add New' button again the same thing happens. The 'Delete' button for each instance also fails. Have I missed something obvious in my config?
Do you have gem 'nested_form' in your Gemfile ?
If so, you should remove it and use the included version instead.
Nope, afraid not.
I also did a gem list to double check and the only nested_form gem I have is this one
I have the same problem as @pollingj.
Having associations set up as follows:
class Rejection < ActiveRecord::Base
belongs_to :rejectable, :polymorphic => true
class Photo < ActiveRecord::Base
has_many :rejections, :as => :rejectable
when editing photo through rails_admin and clicking 'add new' button next to rejections, two rejection nested forms show up. Additionaly 'remove' button does not work on any of them. The problem occurs for any nested association. I havn't changed default config inside rails_admin initializer. I also don't have nested_form gem in my Gemfile or anywhere in project's gem list.
In the I switched to activeadmin, but only because the client asked for a load of additional changes that were easier to sort in activeadmin. However, I did spot that when I was running this on production the above problem didn't occur, even though it did in development.
Somehow, it looks like the asset pipeline is messing up with you guys.
I'm interested if you can investigate a bit to see what's causing it.
Thanks guys for your responses! You are right bbenezech - I was not using asset pipeline the right way. I was precompiling assets on development and commiting them into repository. That was causing various problems. So I've removed public/assets and I'm doing assets precompiling only during deployment. Everything works fine now.
sorry, meant to say....yep, that's pretty much the problem I was having as well :)
Ok, closing then.
add a check for abstract_model visibility in action authorization