Ruby on Rails
Thursday, March 21, 2019
My rails app display the authenticity token in the browser url, when i click on send in my contact form, how do i make it not shown??
here is it => http://localhost:3000/contacts/new?utf8=✓&authenticity_token=JidgUrJ2OXU%2Fy482tx8%2Bua0ZhqRwHSkXme9
Rails 5.1
ruby 2.3
routes.rb
Rails.application.routes.draw do
resources :homepage
root 'homepage#index'
resources :contacts, only: [:new, :create]
end
resources :homepage
root 'homepage#index'
resources :contacts, only: [:new, :create]
end
Contacts controller
contacts.rb
class ContactsController < ApplicationController
def new
@contact = Contact.new
end
def create
@contact = Contact.new(params[:contact])
@contact.request = request
if @contact.deliver
flash.now[:error] = nil
else
flash.now[:error] = "Error, couldn't send Message."
render :new
end
end
end
def new
@contact = Contact.new
end
def create
@contact = Contact.new(params[:contact])
@contact.request = request
if @contact.deliver
flash.now[:error] = nil
else
flash.now[:error] = "Error, couldn't send Message."
render :new
end
end
end
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJvOKtEeD%2Bn0JNXuwkU9XzP6gyXUs2KxyyzyTTdmWZopb7jueQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment