Sha256: 12a3f7bb99bee6a7af7d553d5691ba1063c6a0f1eabab2fe1a0b7b02b5f9509a
Contents?: true
Size: 1.16 KB
Versions: 5
Compression:
Stored size: 1.16 KB
Contents
module Rodauth module Rails class App # Roda plugin that sets up Rails flash integration. module Flash def self.load_dependencies(app) app.plugin :hooks end def self.configure(app) app.before { request.flash } # load flash app.after { request.commit_flash } # save flash end module InstanceMethods def flash request.flash end end module RequestMethods # If the redirect would bubble up outside of the Roda app, the after # hook would never get called, so we make sure to commit the flash. def redirect(*) commit_flash super end def flash rails_request.flash end def commit_flash if ActionPack.version >= Gem::Version.new("5.0") rails_request.commit_flash else # ActionPack 4.2 automatically commits flash end end private def rails_request ActionDispatch::Request.new(env) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems