views:

115

answers:

1

I have the following two action methods:

def index
  puts "==index== flash: #{flash.inspect}"
end

def create
  flash[:notice] = "Blah"
  puts "==create== flash: #{flash.inspect}"
  redirect_to(:action => :index)
end

index.fbml.erb contains this:

<%= button_to_with_facebooker "Blah!", :action => :create %>

The application is used through Facebook. I click the button and the flash contains the notice while create is being executed, but after that it's empty again. It doesn't survive a redirect. Any ideas what's going on here?

A: 

I've found one workaround. While using ActiveRecord to store the session, add

ActionController::Dispatcher.middleware.delete Rack::FacebookSession
ActionController::Dispatcher.middleware.insert_before(
  ActionController::Base.session_store,
  Rack::FacebookSession,
  ActionController::Base.session_options[:key])

in an initialization file, like config/initializers/session_store_fix_facebooker_session_key.rb

This has been done on by someone else before and he explained it on a message on the Facebooker group on but it doesn't work with the cookie session storage, Rail's default.

J. Pablo Fernández