From: bakanon@... Date: 2007-10-26T06:40:04+09:00 Subject: Re: Problem with attribute name On Oct 25, 6:20 pm, Daniel Waite wrote: > unknown wrote: > > Hi, i'm new at ruby on rails and i have this little problem. I have a > > table named "translations". Translations has "id", "message" and > > "description" as attributes. When i try to get information from > > "translations" i write > > > aux1 = Translation.find_by_id(1).description > > > and no problem with that, but when i write this > > > aux2= Translation.find_by_id(1).message > > > it return something like #Message:0x4851f70 > > > i've tried with Translation.find_by_id(1)."message" or > > Translation.find_by_id(1).'message' but nothing works. Any idea how > > should i rescue the value??. I can't rename the attribute on data > > base :( > > Did you design the model? When you see something like Message:0x4851f70, > that's usually an instance of a class. Are you using aggregate objects > for that model? > > http://api.rubyonrails.org/classes/ActiveRecord/Aggregations/ClassMet... > -- > Posted viahttp://www.ruby-forum.com/.- Hide quoted text - > > - Show quoted text - Hi, i'm working with an existing model. There's another table named "messages" and it's related with translations. Translations belongs_to :message and message has_many :translations. Translation has a "message_id" attribute. Maybe there's a name confusion there, between the table and the atribute, but with "description" i have no problem.