Flash not saved when redirecting to Facebook in Rails app

I have the following two methods of action:

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 the following:

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

The application is used through Facebook. I press a button and Flash contains a notification while the creation is in progress, but after that it is empty again. He is not experiencing redirects. Any ideas what is going on here?

+3
source share
1 answer

I found one workaround. When using ActiveRecord to store a 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 the initialization file, e.g. config / initializers / session_store_fix_facebooker_session_key.rb

- he Facebooker, cookie, .

0

Source: https://habr.com/ru/post/1731719/


All Articles