I'm not sure about that.  Many cases it doesn't make sense.  In fact,
probably a large majority of models don't need the concept of an owner
much less a last touched by.  I'm probably at a 10-20% of models
needing an owner and none with an updater.  I think if you need an
updater, you probably should go further and implement some sort of
versioning or at least auditing alongside it.  Most of the time you
need to know who made a change, you want to know the whole history of
a particular object.

If you have a case where you find you need that same function over and
over and maybe permissions to go along with it, probably best to move
it off into a module similar to the owned_model from hobo cookbook.

On Aug 26, 9:41 am, Henry Baragar <[email protected]>
wrote:
> Matt,
>
> Although it can be done like that, my thought is that userstamps should be
> added to the Hobo model generation, so that everyone gets it automatically.
>
> That is, in the file:
>
> vendor/plugins/hobo/hobofields/rails_generators/hobofield_model/templates/model.rb.erb
>
> replace "timestamps" with "userstamps".  (And add the necessary code to
> after_create and after_save).
>
> Regards,
> Henry
>
> On August 21, 2009 05:51:34 pm Matt Jones wrote:
>
> > Well, some of this is already present. If you set an association:
>
> > belongs_to :creator, :class_name => 'User', :creator => true
>
> > It will automatically associate created records to that user. You can
> > also (I seem to recall) set :creator => true on a string field, which
> > gets the creating user's name_attribute value.
>
> > I've not seen a lot of use cases for updated_by, but it should be
> > doable in a before_save callback, I believe.
>
> > --Matt Jones
>
> > On Aug 21, 2009, at 4:26 PM, Henry Baragar wrote:
> > > Hello,
>
> > > It occurs to me that the "timestamps" directive in Rails would have
> > > a corresponding "userstamps" in hobo that would include:
> > >       • created_by: belonging to user set upon creation
> > >       • updated_by: belonging_to user and set upon update
> > > because Hobo adds a user model to the Rails framework. This would
> > > make the timestamps much more useful, IMHO.
> > > Regards,
>
> > > Henry
>
> > > Henry Baragar
> > > Instantiated Software
>
> --
>
> Henry Baragar
> Instantiated Software
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to