title: Rails 5 how to create nested attributes
body: <p><strong>fuel_consumption.rb</strong></p>
  
  <pre><code>class FuelConsumption &lt; ApplicationRecord
    after_initialize :set_defaults, unless: :persisted?
  
    def set_defaults
      self.date ||= Date.today
    end
  
    belongs_to :boiler
    validates :fuel, numericality: {message: 'Поле может быть только числовое'}
    validates :fuel, presence: 'Поле топлива не может быть пустым'
    validates_uniqueness_of :date, scope: :boiler_id, message: 'Эта дата уже заполнена'
    validates :date, presence: 'Дата не может быть пустой'
  end
  </code></pre>
  
  <p><strong>new.html.slim</strong></p>
  
  <pre><code>h4 Расход топлива
    = form_for(@branch, url: {action: 'create'}, method: 'post') do |f|
      = f.fields_for :boilers do |ff|
        = ff.fields_for :fuel_consumption do |fff|
          .form-group
            = fff.label :fuel, 'Дата'
            = fff.text_field :date, class: 'form-control', disabled: 'disabled', value: I18n.l(Date.today, format: :long)
          .form-group
            = fff.label :fuel, 'Количество топлива'
            = fff.text_field :fuel, class: 'form-control'
      .form-group
        = f.submit 'Сохранить', class: "btn btn-lg btn-success"
  </code></pre>
  
  <p><strong>fuel_consumption_controller.rb</strong></p>
  
  <pre><code>  def new
      @branch = current_user.branches.first
      # @fuel_consumption = FuelConsumption.new
    end
    def create
      @branch = current_user.branch.update_attributes(branch_params)
  
      if @branch
        render :success
      else
        flash.alert = 'Oops'
        render :action =&gt; 'new'
      end
    end
  
  
    def branch_params
      params.require(:branch).permit!
    end
  </code></pre>
  
  <p>I have assigned to user 1 branch, which have few (4 or 5) boilers, and i want to create fuel consumption on each boiler from one page, how to achieve that. 
  This code updates attributes, but doesn't create fuel_consumption.</p>