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
Using Form_For Tag with Get Method
Monitor Ruby Processes with Monit
Catching Command-Line Errors Using %X
Should Gemfile.Lock Be Committed to Source Control on Windows
How to Prevent Rails Controller Generator to Modify Config/Routes.Rb
Ruby - Naming Convention - Letter Case for Acronyms in Class/Module Names
Do I Need to Indent My Code in Ruby
Ruby on Rails How to Deal with Nan
How to Test Whether a String Would Match a Glob in Ruby
How to Convert 1 to "First", 2 to "Second", and So On, in Ruby
Bundle Exec Jekyll Serve: Cannot Load Such File
Ruby Minitest Assert_Output Syntax
How to Define a Method in Ruby Using Splat and an Optional Hash at the Same Time
Routing Error No Route Matches [Get] "/Static_Pages/Home", Tutorial
Why Is the << Operation on an Array in Ruby Not Atomic
How to Capture a Part of a Screen Using Ruby on Windows
In Ruby How to Tell If a String Input Is in Uppercase or Lowercase