Rails Activeadmin - Custom Association Select Box

Rails Activeadmin - custom association select box

Yes, that is possible. I assume you want to use a DropDown list box for members to select a user from User model.

form do |f|
f.inputs do
f.input :user_id, :label => 'Member', :as => :select, :collection => User.all.map{|u| ["#{u.last_name}, #{u.first_name}", u.id]}
f.input :description
end
end

Create active admin input dropdown using words array

form do |f|
f.input :gender, collection: ["Male", "Female"]
..
end

active admin association not showing dropdown list of category

In addition to the ActiveRecord relationship you need to register the belongs_to with ActiveAdmin:

ActiveAdmin.register Blog do
belongs_to :category, optional: true

See the ActiveAdmin documentation for more details.

ActiveAdmin: Not saving association between my two models

Try

permit_params :image, room_id

f.collection_select :room_id, Room.all, :id, :listing_name


Related Topics



Leave a reply



Submit