Ok, I had tried this but without luck. I added the lib directory to
the init.rb

Merb.push_path(:lib, Merb.root / "lib")

to make sure but this didn't help when loading the module. So, I had
to go for this but it is a bit messy.

class ModelClass
  require Merb.root / 'lib' / 'modelhelpers'
  include ModelHelpers
end


On Apr 22, 3:47 am, Jonathan Stott <[email protected]> wrote:
> On Wed, 21 Apr 2010 12:39:41 -0700 (PDT)
>
> tenstates <[email protected]> wrote:
>
> > This has been bugging me but how best do I share a bunch of methods
> > across multiple models?
>
> modules.  Which is standard ruby.
>
> module DescriptiveName
>   def useful_method
>     # ...
>   end
>
>   def another_useful_method
>   end
> end
>
> class ModelClass
>   include DescriptiveName
> end
>
> Or if you want class methods, extend!
>
> Regards
> Jon
>
> --
> You received this message because you are subscribed to the Google Groups 
> "merb" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/merb?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.

Reply via email to