sferik/rails_admin — Issue #895: Has many[:through] associations are not handled correctly
Author: heaven
Created: 2011-12-26 12:59:14+00:00
State: open

I was forced to freeze rails_admin at this commit — 96993f6ebfab8ab6e55b3813224c616c586b7a22 because newest updates broke the edit/create forms http://img52.imageshack.us/img52/9789/profileedit.png

Gender/Timezone/Participations are enums and before they was displayed as filtering select after upgrade they displayed as default select.

Interested/influence conditions are the has_many :through relations:

````ruby
class Profile < ActiveRecord::Base
has_many :profile_interests, :dependent => :destroy
has_many :interests, :through => :profile_interests, :source => :condition

has_many :profile_influences, :dependent => :destroy
has_many :influences, :through => :profile_influences, :source => :condition
end

class Condition < ActiveRecord::Base
has_many :profile_interests, :dependent => :destroy
has_many :interested, :through => :profile_interests, :source => :profile

has_many :profile_influences, :dependent => :destroy
has_many :influencers, :through => :profile_influences, :source => :profile
end
````

You can see that now rails_admin offers to create new Condition instead of assign existing one, btw creating a new Condition is forbidden by cancan (I have next line in my ability.rb cannot [:create, :edit, :destroy], Condition). The same also happens for Projects and Notes (weird as Notes is simple has_many association).

So, behavior is wrong and forms are broken. Is there a way to use old forms? Also would be very convenient if you will create a stable branch and commit only bugfixes to it so rails_admin could be used safely.