问题
This is similar to my previous question Ruby On Rails Active Admin has_many changing dropdown to use a different column
I figured out how to reassign a f.inputs
but how would i go about reassigning the display of the data when viewing an item...
e.g:
Public Git Repo: https://github.com/gorelative/TestApp
Snippet of code i have in my fillups.rb
ActiveAdmin.register Fillup do
form do |f|
f.inputs do
f.input :car, :collection => Car.all.map{ |car| [car.description, car.id] }
f.input :comment
f.input :cost
f.input :mileage
f.input :gallons
f.buttons
end
end
end
回答1:
Modify the show
action
ActiveAdmin.register Fillup do
# ... other stuff
show do
attributes_table do
# add your other rows
row :id
row :car do |fillup|
link_to fillup.car.description, admin_car_path(fillup.car)
end
end
end
end
来源:https://stackoverflow.com/questions/10707308/ruby-on-rails-active-admin-has-many-changing-text-to-use-a-different-column