Hi,
I have some models in a file named genel. When I try to use one of the
classes in my controller rails raises an error telling classname.rb is
not forund even the file is required already.
require “genel”
require “hesaplar”
class HesaplarController < ApplicationController
def yeni_firma
@emlak_firmasi = EmlakFirmasi.new
@sehirler = Sehir.find_all
end
end
The odd thing is it is working once when I restart webrick, and after
hitting refresh it raises exception again. Why it is insisting to load
classname.rb, isn’t it poıssible to use custom filenames for models when
you do not use scaffolding etc.
Hello,
On Mon, Feb 13, 2006 at 10:00:23AM +0200, M. Utku Altınkaya wrote:
Hi,
I have some models in a file named genel. When I try to use one of the classes in my controller rails raises an error telling classname.rb is not forund even the file is required already.
require “genel”
require “hesaplar”
You should not use require. Rails has its own dependency tracking
system. Use
class HesaplarController < ApplicationController
model :genel, :hesaplar
def yeni_firma
@emlak_firmasi = EmlakFirmasi.new
@sehirler = Sehir.find_all
end
end
See
http://api.rubyonrails.com/classes/ActionController/Dependencies/ClassMethods.html
Regards,
–
Damien MERENNE [email protected]
http://www.cosinux.org/blogs/dam/
When Chuck Norris sends in his taxes, he sends blank forms and includes
only a picture of himself, crouched and ready to attack.
Chuck Norris has not had to pay taxes, ever.
I do not know how to thank you Damien, I was just stuck, I appreciate
your
help.
----- Original Message -----
From: “Damien MERENNE” [email protected]
To: [email protected]
Sent: Monday, February 13, 2006 1:31 PM
Subject: Re: [Rails] Do I need separate file for each model