Reputation: 6124
I want to include dropdown for the associated columns in rails_admin edit pages.
For example I want to select the user from the dropdown in contact edit.
In my config/initializers/rails_admin.rb
config.model 'Contact' do
edit do
field :user do
partial 'edit_user'
end
end
end
I also have the partial in app/views/rails_admin/main/_edit_user.html.haml
but I didn't get the expected view. How to do this?
Upvotes: 0
Views: 3524
Reputation: 156
I think (correct me if i'm wrong) that you want the field to be shown as a dropdown list of the users in your database. Have you read this page: https://github.com/sferik/rails_admin/wiki/Enumeration ?
You can create a enum method for the field in your model and in the initializer call it like this:
field :user, :enum do
enum_mehod do :user_enum end
end
Upvotes: 2