Ruby on Rails
Tuesday, March 26, 2019
Thanks guys, for your help.But i seems to fix the problem anyway. didn't know why, i wraped the contact#new in a html form element. I removed it and it worked
On Thu, Mar 21, 2019, 7:32 PM Rob Zolkos <rob@zolkos.com wrote:
Looks like you are not redirecting the user to another page when the contact info has been sent.Do you want to redirect them to the home (or another) page and show a "Your message has been sent" alert?replace flash.now[:error] = nil with redirect_to root_path, notice: 'Your message has been sent!'--On Thu, Mar 21, 2019 at 10:05 AM Don Bottles <alg70021@gmail.com> wrote:--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%2Bua0ZhqRwHSkXme9Rails 5.1ruby 2.3routes.rbRails.application.routes.draw do
resources :homepage
root 'homepage#index'
resources :contacts, only: [:new, :create]
endContacts controllercontacts.rbclass 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
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.
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/CAJ6MPz%2BacWb5ivioWN1ocuN_F2wR%2BL%2BG0Tf7iG5U8cf9XKr_rA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
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/CAJvOKtFAY8Qpi8x5qA3HrX2%3DChxXBQxHHEPjZqz%2B%2B2XpxK214g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment