ネストされたフォームでRailsフォームを適切に作成する方法がわかりません。私は多くのチュートリアルに従いましたが、もっと混乱するようになると、それがどうあるべきか、単数の複数、コントローラー...ここに私のモデルがあります
model / event.rb
attr_accessible :description :title, :tag_ids, :locations_attributes
has_many :location
accepts_nested_attributes_for :location, :allow_destroy => true
model / location.rb
attr_accessible :address, :customer_id, :event_id, :latitude, :longitude
belongs_to :customer
belongs_to :event
controller.rb
def new
@event = Event.new
...
def create
@event = Event.new(params[:event])
...
form.html.erbを表示
<%= form_for(@event) do |f| %>
<%= f.fields_for :locations do |e| %>
<%= e.text_field :longitude %>
<%= e.text_field :latitude %>
<% end %>
...
<% end %>
エラー
Can't mass-assign protected attributes: locations
パラメータ送信
"locations"=>{"longitude"=>"45.6666",
"latitude"=>"47.44444665"},
fields_forがサポートしていないために関係が間違っているか、コントローラーが適切でないか、railsが優れた言語ではないか、理解できなくなっています。