I am trying to submit a form for and keep running into this error:
No route matches [POST]
here is my form:
<%= form_for(@issue) do |f| %>
<%= render 'fields', :f => f %>
<div class="actions">
<%= f.submit "Submit" %>
</div>
<% end %>
and my routes:
resources :apps do
resources :issues
end
I think i’m missing something with defining which app it is in the form_for but im not sure?
here’s my issue create action:
def create
@issue = Issue.new(params[:issue])
@issue.app_id = params[:app_id]
if @issue.save
flash[:success] = "Issue added!"
redirect_to @issue
else
render 'new'
end
end
you need to put the app in the form as well. Because you have the issues nested in the apps.
Because you have your routes like this
apps/:app_id/issues/:issues_idYou need to fetch the @app in your controller.You can check your available routes with this command:
rake routes