I need to implement a new action in active admin. I have an index for all my Orders and a need a page for CANCELED ORDERS.
I would be exactly like ORDERS INDEX page, but with a different status.
Is it possibel to do something like this?
index do
column ...
column ...
end
You can use scopes in Active Admin. You could do something like:
scope :all
scope :cancelled_orders, :default => true
And define your :cancelled_orders
scope in your Order
model.
It might be something like:
scope :cancelled_orders, where(cancelled: true)
This way you can switch between the all
and cancelled_orders
views, and the cancelled_orders
will load by default. If you don't need the all
view, you can remove the scope from admin.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.