lib/hobo/lifecycles/creator.rb in hobo-0.8 vs lib/hobo/lifecycles/creator.rb in hobo-0.8.1
- old
+ new
@@ -55,11 +55,12 @@
def run!(user, attributes)
record = lifecycle.model.new
if prepare_and_check!(record, user, attributes)
- fire_event(record, on_create)
- change_state(record)
+ if change_state(record)
+ fire_event(record, on_create)
+ end
record
else
raise Hobo::Model::PermissionDeniedError
end
end