indexdoactionsdefault: falsedo|order|raw%|
#{iforder.editable?link_to"改总价",change_price_admin_order_path(order)end}
|endendmember_action:change_price,method: :getdoresourceend# 改总价member_action:change_total,method: :putdoresource# do what you want to doflash[:notice]="改总价成功"redirect_toadmin_order_path(@order)end
1 产品列表添加链接
ActiveAdmin.register Product do
index do
...
actions do |p|
link_to '加为广告', {controller: 'admin/ads', action: 'new', product_id: p.id}
end
end
end
2 广告添加 controller.new
ActiveAdmin.register Ad do
controller do
def new
product_id = params[:product_id]
@ad = Ad.new
@ad.product_id = product_id
end
end
end