RailsCasts Pro episodes are now free!

Learn more or hide this

jan's Profile

GitHub User: jan

Comments by

Avatar

I don't see why you keep saying that you cannot get the user reference in the model. On create the activity owner would be the creator referenced in the recipe/comment. If other users can update these, you would likely store the last modifier in the database for later reference anyway, so you can also reference them in the callback.

For me, this functionality does belong in a callback and nowhere else, precisely because it is possible that there are other ways, these items can be created. Things like combining/filtering/spam protection would also have to be implemented when you create activities in the controller at some point of professionalization of an app. So this is no argument against callbacks.