Is it possible to define a before_save in a module? So with a class like this:
class Model include MongoMapper::Document include MyModule end
and a module like this:
module MyModule before_save :do_something def do_something
will do_something be called before the Model objects are saved? I tried it like this, but get the undefined method 'before_save' for MyModule:Module .
Sorry if this is something simple - I'm new to Ruby and Rails.
ruby ruby-on-rails
Russell Sep 16 '11 at 12:16 2011-09-16 12:16
source share