Re: [Rails] MyApp/lib/ directory: How to deal with it?

2013-04-17 Thread Yuichi Matsuda
what i usually do is adding autoload_path. in config/application.rb, i append config.autoload_paths += %W(#{Rails.root}/lib/validators) then i put generic validators such as EmailValidator into lib/validators directory after that, all i need is class SomeModel ActiveRecord::Base

[Rails] MyApp/lib/ directory: How to deal with it?

2013-04-16 Thread Wins Lin
The Guide says about /lib directory: lib/ Extended modules for your application. Somewhere I read that I could place there my custom email validator class. But how to use it then? How to require it? Now I do this way in my create method: def create require myEmailValidator