我遇到了一個Rails問題,不會在引導操作中發送任何內容。 我正在使用一個嵌套的複數資源,可能或可能不是問題來自哪裏(Rails有form_for和單數 資源URL的問題)的單數資源。Rails在單一資源表單上嵌套資源
無論如何,我有這個在我的路線:
resource :event do
resources :actions, :only => [:create], :controller => "events/actions"
end
的觀點:有
def create
@event = Event.find(params[:event_id])
@action = @event.actions.create(params[:action])
end
好漂亮的標準無後顧之憂:
<%= form_for([@event, Action.new], :remote => true) do |f| %>
<div class="field">
<%= f.label :team_id %>
<br />
<%= f.text_field :team_id %>
</div>
<div class="field">
<%= f.label :message %>
<br />
<%= f.text_field :message %>
</div>
<div class="field">
<%= f.label :score %>
<br />
<%= f.number_field :score %>
</div>
<br />
<%= f.submit "Update score" %> or <%= link_to "cancel", "#", :id => "cancel" %>
<% end %>
的創建操作。 但是,當我從Rails獲得參數時,沒有任何東西存在。 :(
PARAMS:
Started POST "/event/actions.4e67f09349ae71090c00000e"
Processing by Events::ActionsController#create as
Parameters: {"utf8"=>"Γ£ô", "authenticity_token"=>"stuff", "commit"=>"Update score"}
Completed 500 Internal Server Error in 31ms
這到底是怎麼回事
編輯:
如果我刪除 「:遠程=>真正的」 線在我看來, 我看到在我的參數中,我得到一個參數「:format」 ,它似乎是事件的ID。
但是,我仍然沒有得到行動參數。 :(
刪除遠程並查看日誌 – apneadiving
我做到了這一點,我看到一個格式參數(而不是event_id)與id通過。但我仍然沒有看到行動的參數?我不明白。 –
請更新您的問題與這些額外的信息 – apneadiving