0
我使用自定义批量操作在Rails应用中使用活动管理。 批处理操作是根据数据库的最后5条记录创建的。请参阅下面的代码。如何在Active Admin自定义批量操作中重新加载代码?
但是,当创建新记录(事件)时,批处理操作不会刷新。我想知道如何强制刷新?是否有一个函数可以调用以使批处理操作从新记录刷新?由于
ActiveAdmin.register TimeLineMessage do
menu
menu label: 'Rundown page'
Event.order("created_at DESC").limit(5).reload.each do |event|
batch_action ("Move to " + event.name.to_s).to_sym do |ids|
TimeLineMessage.find(ids).each do |tlm|
tlm.event_id = event.id
tlm.save
end
redirect_to collection_path, alert: "The content tiles have been moved to "+ event.name.to_s + " event "
end
end
编号:http://activeadmin.info/docs/9-batch-actions.html
你是否知道,如何用其中的附加形式来测试这样的动作? – Aleks