Using Rails 5.2.3, ActiveAdmin 2.1.0 and aasm 5.0.5 I want to create links for the permitted events for a resource managed by aasm. I want to show the links for the status change in the index page, it works with this code:
index do
id_column
column :status
actions do |resource|
item 'pdf', pdf_master_fine_path(resource)
resource.aasm.events({ permitted: true }, current_user).map(&:name).each do |event|
item event, polymorphic_path([current_user.role, resource], action: event)
end
end
In the picture I show the result: the links are created but is printed the entire array.
How can I solve? I don't want to print the entire array.
Let's try a naive solution.
resource.aasm.events({ permitted: true }, current_user).map(&:name).each do |event|
item event, polymorphic_path([current_user.role, resource], action: event)
end && nil
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.