IMHO this is a common need and we have implemented this function in a project Tom is working on for us. I OK'd Tom's request to put this into Hobo as we have for many new features sponsored by Barquin projects...
-Owen On Aug 26, 2:16 pm, Bryan Larsen <[email protected]> wrote: > I agree with you both. I've used the updated_at or created_at flag > several times without caring about updated_by or created_by. On the > other hand, if somebody sent in a patch to get me created_by for free, > I'd use it. > > In other words, I don't think it's useful enough to add to Hobo myself, > but if somebody went to the effort, I'd test it and apply it unless Tom > had an objection. > > cheers, > Bryan > > > > Henry Baragar wrote: > > Agreed, many cases it does not make sense. But, it seems to me that the > > cases > > where it does not make sense are the cases where it does not make sense to > > have have timestamps. > > > That is, given that we have a User model, does anyone care about > > last_updated_at but not last_update_by? > > > Put another way why have keep the timestamps, particularly the > > last_updated_at, if we are not keep the associated users? And, it seems > > that > > enough people want both that we have the short cut, which is also the > > default, > > of including both timestamps. > > > Regards, > > Henry > > > On August 26, 2009 01:37:40 pm kevinpfromnm wrote: > >> 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- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
