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
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).
Can someone please tell me how to correct this error so that the flash functionality will work?
Many thanks