# Localization expected, got HashWithIndifferentAccess

**URL:** <https://www.ruby-forum.com/t/localization-expected-got-hashwithindifferentaccess/166074>\
**Category:** Rails\
**Created:** [April 21, 2009, 6:07pm UTC](https://www.ruby-forum.com/t/localization-expected-got-hashwithindifferentaccess/166074 "2009-04-21T18:07:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipecsl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@felipecsl](https://www.ruby-forum.com/u/felipecsl)\
**Post date:** [April 21, 2009, 6:07pm UTC](https://www.ruby-forum.com/t/localization-expected-got-hashwithindifferentaccess/166074/1 "2009-04-21T18:07:53Z")

</div>

Well I Have this models

Localization  
has\_many :event

Event  
belongs\_to :localization

in the view events/new.html.erb

\<% f.fields\_for :localization do |L| %\>

```
<%= l.text_field :country %>
<%= l.text_field :state %>
<%= l.text_field :city %>

```

\<% end %\>

the events controller is ust saving the event model.

But when I submit the page I get “Localization expected, got  
HashWithIndifferentAccess” I tried to modify the controller in many  
ways, but this apper to be happening before arrive in the controller.

By the way, I will use this space also to ask you if there is a better  
way to associate an event with an location making easy to reuse the  
same location for different events and other models I will have?

Thank you

---

<div class="post-metadata">

**Author:** ![felipecsl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@felipecsl](https://www.ruby-forum.com/u/felipecsl)\
**Post date:** [April 22, 2009, 2:37pm UTC](https://www.ruby-forum.com/t/localization-expected-got-hashwithindifferentaccess/166074/2 "2009-04-22T14:37:12Z")

</div>

Anybody have an update to this question?

---

<div class="post-metadata">

**Author:** ![felipecsl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@felipecsl](https://www.ruby-forum.com/u/felipecsl)\
**Post date:** [April 22, 2009, 3:06pm UTC](https://www.ruby-forum.com/t/localization-expected-got-hashwithindifferentaccess/166074/3 "2009-04-22T15:06:04Z")

</div>

Try to specify in your Event model:  
accepts\_nested\_attributes\_for :localization

It should work, but typically it’s used from parent to child (when  
event subform is inside location form).

Also has\_many :event doesn’t have much sence – either has\_one either  
eventS.

Dmitry
