クーポンビューで、helpers / cupons_helper.rbのメソッドを呼び出します。このメソッドは、出力を返す目的でパーシャルを呼び出します。しかし、「テンプレートがありません」というエラーが表示されます。関連するコードは次のとおりです。
views/coupons/show.html.erb:
...
<%= form_for(@coupon) do |f| %>
<% new_include(f) %>
<% end %>
helpers/coupons_helper.rb:
def new_include(f)
new_object = Participation.new
fields = f.fields_for(:participation, new_object, :child_index => :new_include) do |builder|
render "_locations_include", :f => builder
end
end
views/coupons/_locations_include.html.erb:
Include: <%= f.select :participant_id, @groups %><br>
そして、エラーメッセージは次のとおりです。
Missing partial coupons/_locations_include with {:handlers=>[:erb, :builder, :rjs, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/jackrg/Documents/YummiApps/yummi1/app/views"
問題は、「new_include」の「render」の先頭の「_」であることが判明しました。問題が解決しました。