Flash notice

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

I have this in my layout:

<%= flash[:notice] %>

I would check to see, as if I delete this I don't get a flash either.

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

Ok got it !

Have to implement it on the redirected view. Sorry :wink:

Regards,

Joel

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs