У меня есть две модели как x и y, такие что:
y.rb:
class y < ActiveRecord::Base
belongs_to :x
end
x.rb:
class X < ActiveRecord::Base
has_many :Ys
end
мой контроллер будетbe:
x.controller.rb:
def update
@x = X.find(params[:id])
@x.update_attributes(params[:x])
@y = (params[:y])
@y.each { |t| t.attributes = params[:y][t.id.to_s] }
@x.ys.build(attributes)
flash[:notice] = 'X was successfully updated.'
redirect_to :action => 'edit'
end
Это не обновляет данные y и выдает ошибку как:
неопределенный метод `attribute = 'для [" s"," 1233 "]: массив