# Problem with Yaml

**URL:** <https://www.ruby-forum.com/t/problem-with-yaml/89303>\
**Category:** Rails\
**Created:** [March 19, 2007, 12:10pm UTC](https://www.ruby-forum.com/t/problem-with-yaml/89303 "2007-03-19T12:10:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bolo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@Bolo](https://www.ruby-forum.com/u/Bolo)\
**Post date:** [March 19, 2007, 12:10pm UTC](https://www.ruby-forum.com/t/problem-with-yaml/89303/1 "2007-03-19T12:10:41Z")

</div>

Hello

I try to read yaml file. 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

---

<div class="post-metadata">

**Author:** ![Bolo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@Bolo](https://www.ruby-forum.com/u/Bolo)\
**Post date:** [March 19, 2007, 4:32pm UTC](https://www.ruby-forum.com/t/problem-with-yaml/89303/2 "2007-03-19T16:32:24Z")

</div>

It’s correct ?

YAML::load(IO.read("#{RAILS\_ROOT}/db/adresses.yml"))
