0
我是新来的红宝石在轨道上和红宝石轨道上使用第4版工作的项目。现在我正在改变活动管理员中的订单视图,但我收到错误。在ActiveAdmin中自定义“查看”动作
ActiveAdmin.register Order do
permit_params :id, :order_completed, :approved
# changing the visual of view action, so admin user can able to see complete order details
show do |order|
attributes_table do
row :id # Order ID
row 'Name' params[:user].first_name # its not working, not showing the user first_name assiated with order id
# It should be user name. although user first_name is in users table and User model is availble.
row 'Adress' params[:user].address # its not working, not showing the user address assiated with order id
# It should be user address. although user first_name is in users table and User model is availble.
end
end
controller do
def show
order_id = Order.find(params[:id]).user_id
params[:user] = User.find(order_id)
show!
end
end
end
我的目标是显示订单相关联的用户的详细信息,如地址,名称等
Order表由
- id
- user_id
- order_completed (boolean)
- approved
- order_status (string) [in process, done]
用户表组成的
- id
- first_name
- last_name
- address
- membership_id