Skip to content

Commit

Permalink
Add option to reject certain events in the events method
Browse files Browse the repository at this point in the history
  • Loading branch information
dubroe committed Oct 19, 2015
1 parent 5e6a8f0 commit 82ce0fa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/aasm/instance_base.rb
Expand Up @@ -49,6 +49,9 @@ def events(options={})
state = options[:state] || current_state
events = @instance.class.aasm(@name).events.select {|e| e.transitions_from_state?(state) }

options[:reject] = [options[:reject]] if options[:reject].is_a? Symbol
events.reject!{|e| (options[:reject] || []).include?(e.name)}

if options[:permitted]
# filters the results of events_for_current_state so that only those that
# are really currently possible (given transition guards) are shown.
Expand Down

0 comments on commit 82ce0fa

Please sign in to comment.