Home > Software design >  syntax error, unexpected tIDENTIFIER when using form_with ruby on rails
syntax error, unexpected tIDENTIFIER when using form_with ruby on rails

Time:10-01

i am learning ruby on rails and i have a code that is suppose to update a model instance parameters in rails but i get syntax error, unexpected tIDENTIFIER when ever i try to put the method :patch and get a missing method if i don't put it:

this is the line of code:

<%= form_with model: @request  method: :"patch" url: requests_update_path(:id => @request.id) do |f|%>

i had put and delete parenthesis, comas, form_tag , form, method and nothing seams to help :(

pd: the ruby version i am currently using is 2.6.6

CodePudding user response:

You are missing commas (as the comments suggest), also im not sure that :"patch"will work, try method: :patch.

you can find many examples/explanations here should you need to change it further and need inspiration

<%= form_with model: @request, method: :patch, url: requests_update_path(:id => @request.id) do |f|%>
  • Related