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

http://www.cowboycoded.com/tag/acts_as/


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -