On 4 March 2011 16:10, Shandy Nantz <li...@ruby-forum.com> wrote: > Hi All, > > I have an extremely frustrating problem and I kind of think this is an > error in rails, but you never know. > > I have a hash of objects that I am iterating through in order to display > the needed info. As I am doing that and displaying half a dozen values, > one value is being interrupted by rails as a hash and giving me this > error: > > --- !map:HashWithIndifferentAccess comm: "1" comm_percentage: "12" > hotel_name: "111947" rate: "2.00" additional_email_1: "" amenities: cccc > neg_by: Client comm_dollar_amt: "34.00" hod: test rac: xxx billing: "0" > > I understand what the messages says, it thinks I am working with a hash, > the thing is that I'm not. The column is clearly defined as a character > varying as is most all of the other columns which display with no > problem. The thing is I can't figure out how to fix this problem. Here > is some of my code: > > <% @hotelcontracts.each do |@contract| %> > <div id = "contract_<%= @contract.id %>"> > <%= @contract.hotel_name %> > <%= @contract.rate %> > <%= @contract.amen %> ERROR OCCURES HERE
I notice that the hash displayed in the error have a member amenities whereas in the line which generates the error it is amen. Is this part of the problem? What happens if in a console you type c = Hotelcontracts.first (or whetever the model is called) c.amen Otherwise paste the code from db/schema.rb for this table and the code for the model.rb (leave out any immaterial methods in there). Also paste the method from the controller (where presumably @hotelcontracts is setup). Colin > </div> > <% end %> > > Has anybody ran into this issue before? And how did you fix it? Thanks, > > -S > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.