lib/transitions/machine.rb in transitions-0.1.3 vs lib/transitions/machine.rb in transitions-0.1.4

- old
+ new

@@ -97,10 +97,12 @@ end def include_scopes @states.each do |state| state_name = state.name.to_s - raise InvalidMethodOverride if @klass.respond_to?(state_name) + if @klass.respond_to?(state_name) + raise InvalidMethodOverride, "Transitions: Can not define scope `#{state_name}` because there is already an equally named method defined - either rename the existing method or the state." + end @klass.scope state_name, @klass.where(:state => state_name) end end end end