Wes Gamble
2006-Apr-24 22:05 UTC
[Rails] How to require a regular module into my controller?
I created a modules directory under my app. root (RAILS_ROOT/app) I''m trying to "require in" a module in that directory into my controller. I tried require ''modules/module.rb'' I tried require "#{RAILS_ROOT}/app/modules/ESimplyUtil" The module file is in modules/ESimplyUtil.rb. Is that the right name? Neither of these works. How can I successfully require in my module? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
Bakki Kudva
2006-Apr-25 13:21 UTC
[Rails] How to require a regular module into my controller?
Rails loads everything in {$RAILS_ROOT}/lib automatically(then you dont'' have to explicitly require it). That''s where I have my app wide library code. If you want to require a gem or ruby library you can do it in app/controllers/application.rb which then will be available application wide. Atleast this has worked for me. -bakki On 4/24/06, Wes Gamble <weyus@att.net> wrote:> I created a modules directory under my app. root (RAILS_ROOT/app) > > I''m trying to "require in" a module in that directory into my > controller. > > I tried require ''modules/module.rb'' > I tried require "#{RAILS_ROOT}/app/modules/ESimplyUtil" > > The module file is in modules/ESimplyUtil.rb. Is that the right name? > > Neither of these works. > > How can I successfully require in my module? > > Thanks, > Wes > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Apparently Analagous Threads
- Is it possible to interpolating variables in YAML files?
- Best way to organize non-controller logic???
- text_field doesn''t call overridden ActiveRecord getters
- Wrap error_messages_for() call when no instance var present
- How to bypass routing for a particular request?