Forum: Ruby on Rails require file in rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9f72aa5ee72bd13a8b443fbf3797944c?d=identicon&s=25 Kaushik katari (Guest)
on 2008-12-15 01:51
(Received via mailing list)
Hi,
I have a file called dbcon.rb that I put in the config directory.

I want to call it from rake, and I was using
require 'config/dbcon.rb'

This was allowing me to access the classes in this file.

Somehow, the require command cannot find this file anymore. Is there a
path
convention in rails? How do I use require from different parts of my
application?

Sincerely,
Kaushik
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2008-12-18 02:15
(Received via mailing list)
Kaushik katari wrote:
> my application?
You could move it to the lib directory, or write
   require "#{RAILS_ROOT}/config/dbcon.rb"

--
Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com
This topic is locked and can not be replied to.