Rails Activeadmin Drop Down Menu on New and Edit Forms

ActiveAdmin: Generating drop down list in form for has_many/belongs_to relationship

Try this

form do |f|
f.inputs "Image Details" do
f.input :gallery
f.input :file
end
end

Changing what attribute is displayed in drop down association filter in active admin with Rails 3.1 app

I was able to solve my problem by passing :label_method => :company_name to the resource in the resources.rb file under the 'admin' directory.

Create a drop down menu using a Table Attribute in Rails Active Admin

I think you are looking for something as follows:

f.input :membership_code, as: :select, collection: Member.all.map(&:membership_code)

Changing ActiveAdmin resources dynamically in a dropdown menu

I think you can use the filters provided by ActiveAdmin to get the same result. With a custom filter, as described there, you can do basically anything to the collection that is displayed on an index page.

Filtering dropdown when creating a new item in Active Admin Rails

You need to create form for featured teacher, please add below code in featured_teachers.rb active admin file

form do |f|
f.inputs 'Featured Teacher' do
# in the select box only load those users which are teacher and not in featured teacher list you need to add query for it
f.input :user, as: :select, collection: User.where(role: 'teacher').map { |u| [u.name, u.id] }, include_blank: true, allow_blank: false, input_html: { class: 'select2' }
# please also add other fields of featured teacher model

You can check all available options in active admin documentation here



Related Topics



Leave a reply



Submit