Ruby On Rails Active Admin has_many更改文本以使用不同的列
这类似于我之前的问题Ruby On Rails Active Admin has_many更改下拉列表以使用不同的列
我想出了如何重新分配f.inputs
但在查看项目时如何重新分配数据的显示……
例如:
Public Git Repo: https : //github.com/gorelative/TestApp
我在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
修改show
动作
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