search for: log_create

Displaying 2 results from an estimated 2 matches for "log_create".

Did you mean: _oge_create
2006 Jan 17
3
Models, Modules, and Callbacks
...dels by Namespace::Model - Controllers loading models using ? model ''namespace/model'' ? The only problem I am having is callbacks like before_create, after_create, etc seem to get called multiple times. For example... module A class B < ActiveRecord::Base before_create :log_create def log_create puts ''>>> Creating...'' end end end And then do A::B.create, I get multiple ">>> Creating..." messages, but only one object in my table. I am guessing because, in development, require_dependency loads the file multiple t...
2006 Jan 13
1
association callbacks
.... I''m writing a plugin that will log all model changes. I do not want to have to add a line a code for this functionality every time I create a model. Instead I create a table with the name <model>_changes. The basic stuff was easy: base.after_create {|model| model.log_create if model.has_backup_table? } **also log on before_update and before_destroy What I''m curious about is the habtm relationships. I wanted to keep track of when this changes as well. An example would be changing a user''s role. So I did this: def self.included(base) ......