It''s correct ?
YAML::load(IO.read("#{RAILS_ROOT}/db/adresses.yml"))
On 19 mar, 07:08, "Bolo"
<mala...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello
>
> I try to readyamlfile. my model
>
> class Enseignant < ActiveRecord::Base
> file_column :photo,
> :magick => {:geometry => "250x250>"},
> :root_path => File.join(RAILS_ROOT, "public/",
"upload"),
> :web_root => "upload/"
>
> validates_file_format_of :photo, :in => ["gif",
"png", "jpg"]
> validates_filesize_of :photo, :in => 15.kilobytes..1.megabyte
> #validates_image_size :photo, :min => "1200x1800"
>
> has_many :contributions
> has_many :enseignements, :through => :contributions
> has_one :user
>
> def adress
> #chargement du fichier de configuration
> adresse
=YAML::load(IO.read("#{RAILS_ROOT}/db/adresses.yml"))
> return "totto"
> end
> end
>
> In my controler
>
> def show
> @enseignant = Enseignant.find(params[:id])
> @adresse = @enseignant.adress
> #########################################
> # Les Contributions de Cette enseigant
> @prof_enseigns = @enseignant.enseignements
> @contribution = Contribution.new
> @enseignements = Enseignement.find(:all, :order =>
"libelle")
> @enseignants = Enseignant.find(:all, :order => "nom")
> #########################################
> respond_to do |format|
> format.html show.rhtml
> format.xml { render :xml => @enseignant.to_xml }
> end
> end
>
> On my browser i have this error
>
> SystemStackError in EnseignantsController#show
> stack level too deep
>
> And with the console that
>
> >> prof = Enseignant.find(1)
>
> => #<Enseignant:0x36cd9ec @attributes={"....i"}>
> from (irb):10
>
> >> prof.adress
> >> false
>
> Can you help me
>
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---