Hey guys, I posted over on the google groups and am hoping there might be some more eyes here.
Here's the thread: http://groups.google.com/group/rails_admin/browse_thread/thread/676de628d4a14246
Basically I can't get a HABTM association not to be read only no matter what I try to make attr_accessible. This also prevents it from rendering a partial I believe, as rails_admin is seeing it as read only and just giving me the dash. Any examples for the post attr_accessible changes that were made a while back?
Does it work without attr_acessible?
The key you would need to white-list is :collection_singular_ids
Awesome. That was the key for like 90% of it. The one model it didn't work for was a polymorphic association. If it's an address model (aka addressable_id and addressable_type), what would I need to whitelist in the attr_accessible? For example:
has_one :address, :as => :addressable, :dependent => :destroy
So far I've tried :address, :addresses, :addressable_ids, :addressable_id, :addressable, :addressable_type, :address_id, :address_ids. Any ideas for that one?
It should be :address_id
Anyway it's the name of the mass-assigned attribute. Check your params hash when you create/update (without :attr_accessible activated obviously, since RA will not render the non-assignable fields) and you'll get all the attributes you'll need to whitelist.
Ha.. check this out:
undefined method `addres_id' for #College:0x135224120
So I put attr_accessor :addres_id in there and it showed up.
Unfortunately, it's trying to send the wrong param and isn't able to successfully update. Any ideas? Like, can I force it to use a foreign key I specify?
Tested and working now. Thanks Ben!
You're welcome. Thanks for the bug hunting!