class Tbone::Devise::Middleware

Public Class Methods

new(app) click to toggle source
# File lib/tbone/devise/engine.rb, line 13
def initialize(app)
  @app = app       
end

Public Instance Methods

call(env) click to toggle source
# File lib/tbone/devise/engine.rb, line 16
def call(env)      
  warden = env['warden']
  return @app.call(env) if env['REQUEST_PATH'] =~ /^\/assets/
  user = warden.authenticate
  m = self
  Tbone.configure do |c|
    c.add_params currentUser: m.render_user(user || User.new)
    c.add_params guestUser: m.render_user(User.new)
  end
  @app.call(env)
end
render_user(user) click to toggle source
# File lib/tbone/devise/engine.rb, line 27
def render_user(user)
  Rabl.render(user, 'users/show', view_path: 'app/views', format: :hash)
end