I am submitting the form on my edit.html.erb and it is giving me an error for No route matches [POST] "/grouponepostings/17/edit". I am using simple forms in my document and am not sure how to specify that it is a patch request I seek.
Here is routes.rb
Rails.application.routes.draw do
get "/", to: "pages#index"
get "/grouponepostings", to:"grouponepostings#index"
get '/grouponepostings/new', to: 'grouponepostings#new'
get "/grouponepostings/:id", to:"grouponepostings#show"
post '/grouponepages', to: 'grouponepostings#create'
get '/grouponepostings/:id/edit', to: 'grouponepostings#edit'
patch 'grouponepostings/:id/edit', to: 'grouponepostings#update'
end
Here edit.html.erb:
<%= simple_form_for :postings1314 do |r| %>
<div>
<%=r.label :firstName%>
<%=r.text_field :firstName%>
</div>
<div>
<%=r.label :lastName%>
<%=r.text_field :lastName%>
</div>
<div>
<%=r.label :age%>
<%=r.text_field :age%>
</div>
<div>
<%=r.label :bio%>
<%=r.text_field :bio%>
</div>
<div>
<%= r.submit %>
</div>
<%end%>
And here is grouponepostings_controller.rb:
class GrouponepostingsController < ApplicationController
def index
@postings1314 = Grouponepage.all
end
def show
@posting1314singular = Grouponepage.find(params[:id])
end
def new
@postings1314 = Grouponepage.new
end
def create
page_params = params.require(:grouponepage).permit(:firstName, :lastName, :age, :bio)
@posting1314 = Grouponepage.new(page_params)
@posting1314.save
redirect_to '/grouponepostings'
end
def edit
@posting1314 = Grouponepage.find(params[:id])
end
def update
@posting1314 = Grouponepage.find(params[:id])
page_params = params.require(:grouponepage).permit(:firstName, :lastName, :age, :bio)
@posting1314.update(page_params)
redirect_to '/'
end
end