nakajima / rack-flash Goto Github PK
View Code? Open in Web Editor NEWIf you're using Sinatra, you should use sinatra-flash instead.
Home Page: http://nakajima.github.com/rack-flash/
License: MIT License
If you're using Sinatra, you should use sinatra-flash instead.
Home Page: http://nakajima.github.com/rack-flash/
License: MIT License
It does not seem to be working with Sinatra 1.3.2
When just requiring rack-flash it throws this error:
ERROR NoMethodError: undefined method `<<' for nil:NilClass
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/rack-flash-0.1.2/lib/rack/flash.rb:11:in `use'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1339:in `setup_default_middleware'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1327:in `build'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1321:in `new'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1311:in `prototype'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `block in call'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1416:in `synchronize'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `call'
/Users/david/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.0/lib/rack/handler/webrick.rb:59:in `service'
/Users/david/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/david/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/david/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Hi I've just been developing an app in sinatra and just moved my authentication logic to another file, but when i tried to use flash[:notice] from inside that file it is nil al the way. It still works fine for the main file though. It's weird. I just installed sinatra-flash to check if it was me, but this works fine.
Thnx
Hi,
In my sinatra app, I would like to be able to set a flash[:notice] message, then redirect, but it seems that the flash[:notice] is empty after a redirect.
Is this the expected behaviour?
Thanks,
Steven
goes to http://gitrdoc.com/?f
I'm developing a Sinatra application using cucumber.
In my env.rb cucumber configuration file, I have specified:
set :environment, :test
This gives me an error:
Rack::Flash::SessionUnavailable - Rack::Flash depends on session middleware
If you could tell me what's causing that, or how to get round it - would be much appreciated.
Am using:
cucumber (0.4.4)
rack (1.0.1)
rack-flash (0.1.1)
rack-test (0.5.3)
sinatra (0.9.4)
Thanks,
Steven
I've been looking for a simple way to check if the flash is empty, but it does not provide any simple array/hash methods for that.
Maybe adding an empty? method to the class that returns true on empty values.
Any ideas on how to do that right now?
Flash keys are automatically converted to symbols. However symbols are not supported by JSON session cookies.
require 'sinatra/base'
require 'rack/flash'
class Server < Sinatra::Application
configure do
use Rack::Session::Cookie, coder: Rack::Session::Cookie::Base64::JSON.new
use Rack::Flash
end
get '/' do
flash['foo'] = 'bar'
end
end
Server.run!
Running this sample code produces the error:
Rack::Utils::OkJson::Error at /
Hash key is not a string: :foo
Isn't it just requiring rack/flash?
Why not just require "rack/flash" instead of "rack-flash" then?
Just wondering.
A minimal note on Readme file to test the flash value would be great.
I found this way works for me (minitest, rack-test)
assert_equal 'my message', last_request.env['x-rack.flash'][:alert]
To successfully run the tests in my Debian package, I have had to use this patch:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.