Hi There,
I am setting a session, whilst following the rails-space tutorial.
When i hit register, I can see there is a new row inserted to the sessions table, but now - for some reason, I don't get the flash message as before:
My user controller looks like this:
def register @title = "Register" if request.post? and params[:user] @user = User.new(params[:user]) if @user.save session[:user_id] = @user.id flash[:notice] = "User '#{@user.screen_name}' created!" redirect_to :action => "index", :controller => "user" end
My application.rhtml page now has ' <%= debug(session) %> ' added to the page to view the session on the web page
I've added ''config.action_controller.session_store= :active_record_store'' to the environment.rb page.
After a quick google earlier, I kept getting an invalid token error, so i read that adding ''protect_from_forgery :only => [:create, :update, :destroy] '' to the user controller page resolves it. Which it did. I no longer get that error.
However - I have added the code as the book suggests. The user is still successfully added to the site, and visible in the database, but the flash message does not get displayed.
(if i delete this code, I can see the flash message again)
Any ideas??
Many Thanks!