Hobo / hobo

The web app builder for Rails (moved from tablatom/hobo)
http://hobocentral.net
103 stars 39 forks source link

Lifecycle create actions ignore :creator attribute on belongs_to association #146

Closed stevemadere closed 9 years ago

stevemadere commented 9 years ago

When I declare a belongs_to association in a model and add the attribute :creator => true to it, the user_create action takes care of setting that association equal to acting_user.

This is well documented here: http://hobocentral.net/manual/permissions#afterusernew----initialise-a-record-using-actinguser

However, if an instance is created through any lifecycle create action, it does not invoke Hobo::Model#set_creator.

This has the unfortunate result of not setting the creator when instances are created through a lifecycle create action.

I am guessing this is not intentional.

It was a pain in the neck to determine this is what was making my validations fail when creating via a lifecycle action.

The problem seems to be in: Hobo::Model::Lifecycles::Creator#run!

I suspect that it should call _lifecycle.model.usernew(user) instead of lifecycle.model.new at the beginning of this method.

iox commented 9 years ago

147 has been merged, closing this now :+1: