ruby on rails - A way to handle common behaviors -
i using ruby on rails 3.0.7 , have multiple resources almost have same behavior. is, almost have same model, controller , view codes , same database table columns definition.
so find way dry resources. implemented modules , mixins in order share part of code (as validation methods, callbacks, view files not controller files that, anyway, have similar code).
now, how can handle common behavior? should use ruby on rails developers named acts_as_something
? advice about?
i think did that, name method in modules act_as_your_module_name , make sure module extends base class, e.g. activerecord::base.extend act_as_your_module_name
Comments
Post a Comment