title: How to display data from two tables into one form
body: <p>I use Ruby v 3. I want to display data from 2 tables into one form.
  My models:</p>
  
  <pre><code>class Address &lt; ActiveRecord::Base
    attr_accessible :city, :number, :street
  
    validates :city, :presence =&gt; true
    validates :number, :presence =&gt; true
    validates :street, :presence =&gt; true
  
    has_many :users
  end
  
  class User &lt; ActiveRecord::Base
    belongs_to :address
    attr_accessible :name, :phone, :surname, :address_attributes
    accepts_nested_attributes_for :address
  end
  </code></pre>
  
  <p>My form looks alike:</p>
  
  <pre><code>&lt;%= form_for(@user) do |f| %&gt;
  
    &lt;div class="field"&gt;
      &lt;%= f.label :name %&gt;&lt;br /&gt;
      &lt;%= f.text_field :name %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :surname %&gt;&lt;br /&gt;
      &lt;%= f.text_field :surname %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :phone %&gt;&lt;br /&gt;
      &lt;%= f.text_field :phone %&gt;
    &lt;/div&gt;
  
    &lt;%= f.fields_for :address_attributes do |p| %&gt;
    &lt;div class="field"&gt;
      &lt;%= p.label :city %&gt;&lt;br /&gt;
      &lt;%= p.text_field :city %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= p.label :street %&gt;&lt;br /&gt;
      &lt;%= p.text_field :street %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= p.label :number %&gt;&lt;br /&gt;
      &lt;%= p.text_field :number %&gt;
    &lt;/div&gt;
   &lt;% end %&gt;
   &lt;div class="actions"&gt;
      &lt;%= f.submit %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>As you can see I use fields_for method. And my controller is here:</p>
  
  <pre><code>def edit
    @user = User.find(params[:id])
    @user.address_attributes = @user.address
  end
  </code></pre>
  
  <p>It does not working and I totally don't know why. When I click edit on address list i've got an error:</p>
  
  <pre><code> undefined method `with_indifferent_access'
  </code></pre>
  
  <p>Anyone can help me figure it out?</p>