Ruby On Rails Active Admin has_many changing dropdown to use a different column
activeadmin, ruby, ruby-on-rails
Solution
Something like this should work...
In `app/admin/model_name.rb`
form do |f|
f.inputs "My Model Name" do
# add your other inputs
f.input :cars, :collection => Car.all.map{ |car| [car.description, car.id] }
f.buttons
end
end
Read this article to learn more about modifying the form.
AciveAdmin uses formtastic, you should read about that as well.
Problem
I am completely new to ActiveAdmin and RoR and i cant figure out how to change the visible value of the dropdowns in a has_many association. Fillup Model ``` class Fillup < ActiveRecord::Base // key is car_id:integer belongs_to :car end ``` Car Model ``` class Car < ActiveRecord::Base validates :description, :presence => true key is fillup_id:integer has_many :fillups end ``` What it currently shows: It currently shows im assuming an encoded reference to the Car assigned to it. What i need it to show: I need it to show the description given which is defined as `description:string` in the `Car Model`.