Answer the question
In order to leave comments, you need to log in
How to draw the form correctly?
the form code is in app/views/request/new.erb:
<%= simple_form_for(@request, remote: true) do |f| %>
<%= f.input :phone, prompt: "Телефон" %>
<%= f.input :email, prompt: "email" %>
<%= f.button :submit %>
<% end %>
undefined method `requests_path' for class many digits
Did you mean? request
class RequestController < ApplicationController
def new
@request = Request.new
end
def create
@request = Request.create(request_params)
respond_to do |format|
format.html
format.json{render :json => @request}
end
end
def update
@request.update(request_params)
end
private
def request_params
params.require(:request).permit(:email, :phone)
end
end
root 'request#new'
post '/request/create' => 'request#create'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question