Skip to content

sinatra-flash gem isn't working #9

@trekr5

Description

@trekr5

Hello,

Attempted to use the sinatra-flash gem with my app and get the following error of "undefined local variable or method 'flash'" when I try to run my app.

Background

my_app

require 'sinatra/base'
require 'sinatra/flash'

class GGInfraUserManager < Sinatra::Base
enable :sessions
register Sinatra::Flash

...(rest of app)

post '/' do

flash[:error] = "Password must be a minimum of 8 characters" unless new_password.match /.{8}/
log.info "#{Time.now} password meets policy requirements"
end
redirect '/'
end

in my view file..(at the top).

× <%= flash.now[:error] %>

Can someone please tell me how to correct this error so that the flash functionality will work?

Many thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions