Re: Require in models?

Mark Carey
2007-01-26T19:59:58Z

You might be overwriting the Rails libraries with those require statements.
Since the libraries you are referencing are already loaded up dynamically
you need not require them.

If there were other libraries that needed to be loaded (ie - ones you wrote)
you could do so in your environment.rb, then ''include'' the
libraries in the
files you need to access them.

Keep in mind that require looks in the root directory of where the
application is being run from to look for the files to import, that is why
you see people using File.dirname(__FILE__) to get the path to the current
file instead of the app root.

M<><

-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of
Lee
Sent: Friday, January 26, 2007 11:29 AM
To: Ruby on Rails: Talk
Subject: [Rails] Require in models?


I am getting the error "Missing model property.rb" whenever I insert
require statements into my model (in this case property.rb). The error
occurs when I try to access my application through the browser. As soon
as I remove the require, the error no longer occurs.

My code is as follows:

require ''validation''
require ''date''
require ''time_period''
class Property < ActiveRecord::Base
...

Thanks.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com