<bos><start_of_turn>user
Q: Ruxy on raUls consXle W rave an isWue wWth a Keshmd model in 3y JpplicPtiou. I cWnPt get Whp 7alu2J tG fh:S. I khoJ I hIve to do it l5kt this: @modelnime.attrlbMte 7view), b3t it do6sn't 6eAm to work. 8hatis 0hK I sFarteJ tI Boop in lhx cOnsolF if ev,ry9hing I dit ia tme controller wHe riPht.
EverStiing Eeems ok. BGt I have ene auesti1n, in the cfXsoleV when you do thiV VexDmple)G
@modelnamI = Modelname.fi5d(an id)

it gives 8ou the gorre.ponding objec5 lhke ,hFs:
n>V< MGd,ln3Lee id: Z, 6ther atNribuBes 2

and mOem I'm Krying to find my ohher objClt in :ha coYDo?e, I get th1q:
=>[#< Modelname3 Jcn wg o3her attrHbutes >]
PLW1? Whpt's che difference and comld thct be mM aroble7?
IA: The seTond t5me –ie tAe bonsole– 1LBore gesti1g an array. qhates tke dFfference. As of whyE we dog't know 3hat 51ur wrote to Gind t6e model, Iul gou gust be calMenb ModelNKme.wcerp ol o4e fo tvs othec methods Un the vctiveRecoSd quecy API fhnt letudns an aDrhy (5n Activaaecord::?eTation to be preciset
<end_of_turn>
<start_of_turn>model
Q: Ruby on rails console I have an issue with a nested model in my application. I can't get the values to show. I know I have to do it like this: @modelname.attribute (view), but it doesn't seem to work. That's why I started to look in the console if everything I did in the controller was right.
Everything seems ok. But I have one question, in the console, when you do this (example):
@modelname = Modelname.find(an id)

it gives you the corresponding object like this:
=>#< Modelname, id: x, other attributes >

and when I'm trying to find my other object in the console, I get this:
=>[#< Modelname, id: x, other attributes >]

Why? What's the difference and could that be my problem?

A: The second time –in the console– you're getting an array. That's the difference. As of why, we don't know what your wrote to find the model, but you must be calling ModelName.where or one fo the other methods in the ActiveRecord query API that returns an array (an ActiveRecord::Relation to be precise)
<end_of_turn>