From: Jan Svitok Date: 2006-10-20T23:43:55+09:00 Subject: Re: where to put require On 10/20/06, Bira wrote: > On 10/20/06, Ike wrote: > > If I have a rails app and I need to put in > > require 'xxx' > > include yyy > > > > in my class ApplicationController < ActionController::Base > > > > Where within this application.rb file do I put these lines? Thanks, Ike > > It's usually best to put it in the first lines of the file, before any > variable declarations or class definitions. They're a bit like C's > "" or Java's "imports". And be careful where you place include Yyy as the placement influences where the module will be mixed in. It's different when you do include Forwardable class X ... end and class X include Forwardable ... end Sometimes (=rarely), when you want to require later or not at all, it's useful to put require inside a method.