samedi 16 janvier 2016

Why in rails I cannot extract specifi value from a recod when I use -Where- keyword

I want to extract a specific value from a record. I can do this to just exctract the title of the article:

x = Article.find(2)
x.title

But Why it gives an error when I do it like this

x = Article.where(:id => 2)
x.title

I want to use "WHERE" in my action because without it I could not be specific

Aucun commentaire:

Enregistrer un commentaire