You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also have a quick fix for myself, but there is one interesting thing… The Rails have a very similar bug: rails/rails#14439. Maybe we shall wait for them to make a consistent fix then?
But we can wait for ages considering their bureaucracy… 8(
+1. I temporarily configured the association invisible for the edit action.
class User < ActiveRecord::Base
has_many :phone_numbers, foreign_key: :user_custom_key, primary_key: :custom_key
rails_admin do
edit do
configure :phone_numbers do
visible false
end
end
end
end
class PhoneNumber < ActiveRecord::Base
belongs_to :user, foreign_key: :user_custom_key, primary_key: :custom_key
end
Apparently the problem does not afflict the belongs_to side.
Given two models,
User
andInvitation
:Rails admin throws a
NoMethodError
error when loading the edit page NoMethodError in RailsAdmin::Main#editI tracked this down to be on line 21 where
field.associated_primary_key
is sent too
, this needs to befield.foreign_key
.I'll submit a pull request soon (if I make this change it fixes my issue), but I'm not sure what else my change might break.
The text was updated successfully, but these errors were encountered: