aasm

rails aasm: Get all states that allow an specific event

怎甘沉沦 提交于 2019-12-24 07:56:09
问题 I'm new to AASM, and trying to get a list of all states in a MyModel model that can transition to state :newstate. So, for example: aasm_event :finish do transitions :to => :finalstate, :from => [:start, :working] end Basically, I want to return the [:start, :working] array via the model, so something along the lines of MyModel.aasm_events.finish.transitions.from But, well, that's not the syntax...and I can't find anything for it in the docs. Any suggestions appreciated. 回答1: It wasn't

ActiveAdmin + CanCan + AASM event switcher with AJAX

你离开我真会死。 提交于 2019-12-08 12:37:07
问题 As an admin I have a specific role I want to see and switch event for object Depends on my role Inspired by activeadmin_addons and its Enum Integration I want to make similar functionality for AASM by letting diffent admin users change events depending on their abilities/roles for specific events/statuses in model. 回答1: Taken from here, please see this link for additional files you need Prequestites: Gem: ActiveAdmin, Gem 'active_admin_role', both are installed and working AdminUser model