Friday, March 4, 2011

[Rails] Re: !map:HashWithIndifferentAccess

> 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?

This is were I think Rails is falling down. Originally I had that field
named as "amenities," but when the same error was occurring I thought
maybe that was a key word, or something, and changed it to "amen." But
obviously the problem persists.

> What happens if in a console you type
> c = Hotelcontracts.first (or whetever the model is called)
> c.amen

This produces the same output.

> 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

Model:
class Hotelcontract < ActiveRecord::Base
belongs_to :account
end

Controller:
@hotelcontracts = Hotelcontract.find( :all, :conditions => ['account_id
= ?', @account.id])

db:
amen is simply defined as a character varying with nothing really
different then any of the other fields in the table.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate