ruby on rails - Extend ActiveRecord -


my first foray modules!

lib/model_extension/say_hello

module firstmodule end  class activerecord::base   include firstmodule end 

the code in example raises error:

lib/model_extension/say_hello.rb:5:in `<top (required)>': uninitialized constant activerecord (nameerror) 

so mean? need include activerecord::base before telling include modules? putting module in wrong place?

and how should include module in model?

include firstmodule 

would trick, properway it? when install gem alters models, include this:

has_secure_password  

how should set can include module that?


Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -