mercredi 8 mars 2017

Update nested Attributes on rails 3

In rails 4 usually updating a nested attributes we do:

and in rails 3? should user params.require?

def sent

@user.update_attributes(order_params)

  def order_params
  params.require(:user).permit( order_attributes: [:track_number])
end 

end




class User < ActiveRecord::Base

  has_many :orders

end

Aucun commentaire:

Enregistrer un commentaire