Hello,
I''m using this piece of code to allow users to register to my site :
def create
cookies.delete :auth_token
@user = User.new(params[:user])
@user.save!
#Uncomment to have the user logged in after creating an account
- Not Recommended
#self.current_user = @user
flash[:notice] = "Thanks for signing up! Please check your email
to activate your account before logging in."
redirect_to :controller=>''sessions'',
:action=>''new''
rescue ActiveRecord::RecordInvalid
flash[:error] = "There was a problem creating your account."
render :action => ''new''
end
The code works pretty well, except for the flash notice message that
I''m not seeing ! User account information is well inserted in the
database.
Can someone help ? May be its due to the layout i''m using currently ?
Please let me know.
Regards,
Joel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I have this in my layout: <p style="color: red"><%= flash[:notice] %></p> I would check to see, as if I delete this I don''t get a flash either. On Wed, Apr 30, 2008 at 8:12 AM, joel <joel.sooriah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, > > I''m using this piece of code to allow users to register to my site : > > > def create > cookies.delete :auth_token > @user = User.new(params[:user]) > @user.save! > #Uncomment to have the user logged in after creating an account > - Not Recommended > #self.current_user = @user > flash[:notice] = "Thanks for signing up! Please check your email > to activate your account before logging in." > redirect_to :controller=>''sessions'', :action=>''new'' > rescue ActiveRecord::RecordInvalid > flash[:error] = "There was a problem creating your account." > render :action => ''new'' > end > > The code works pretty well, except for the flash notice message that > I''m not seeing ! User account information is well inserted in the > database. > > Can someone help ? May be its due to the layout i''m using currently ? > > Please let me know. > > Regards, > > Joel > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, thank you for your reply but I can''t add a html tag in the controller. This isn''t working unfortunately. Having an " unexpected ''<'' " error. Regards, Joel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok got it ! Have to implement it on the redirected view. Sorry ;-) Regards, Joel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---