diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-01-04 16:09:16 +0100 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-01-04 16:09:16 +0100 | 
| commit | 786fcc4f1cce2dfae8a7c1b3a8c88818af762712 (patch) | |
| tree | b096b5cafac85e05302b30c99a37e853e348a969 | |
| parent | 53021059e8e7eeb831fb91a45629618bc745940b (diff) | |
| download | zorglub-786fcc4f1cce2dfae8a7c1b3a8c88818af762712.zip zorglub-786fcc4f1cce2dfae8a7c1b3a8c88818af762712.tar.gz  | |
example: update to work with rack session
| -rw-r--r-- | example/sample.ru | 21 | ||||
| -rw-r--r-- | example/view/url3/index.haml | 1 | 
2 files changed, 13 insertions, 9 deletions
diff --git a/example/sample.ru b/example/sample.ru index b5824c0..3c1af4e 100644 --- a/example/sample.ru +++ b/example/sample.ru @@ -2,8 +2,14 @@  #  $LOAD_PATH << File.join(File.dirname( File.absolute_path(__FILE__)), '..', 'lib')  # +USE_RACK_SESSION=false +#  require 'zorglub' -require 'zorglub/session' +if USE_RACK_SESSION +    require 'zorglub/rack_session' +else +    require 'zorglub/session' +end  #  require 'haml'  HAML_PROC = Proc.new { |path,obj| Haml::Engine.new( File.open(path,'r').read ).render(obj) } @@ -96,7 +102,6 @@ class Node3 < Zorglub::Node      def index *args          @title = "Session tests"          t = Time.now -        @sid = session.sid          if session[:now].nil?              session[:now] = t              @data = "#{t.strftime('%H:%M:%S')} FIRST" @@ -108,7 +113,7 @@ class Node3 < Zorglub::Node          end      end      def reset -        session.destroy! +        session.clear          redirect :index      end      # @@ -138,15 +143,15 @@ Node1::LINKS= [  ]  #  puts APP.to_hash.inspect +puts "  **** "+( USE_RACK_SESSION ? 'USE Rack Session' : 'USE builtin Session' )  #  map '/' do      use Rack::Lint      use Rack::ShowExceptions -#    use Rack::Session::Cookie,  :key=>Zorglub::Session.key, -#                                :secret=>'my-secret-secret', -#                                :path=>'/', -#                                :http_only=>true, -#                                :expire_after=>30 +    if USE_RACK_SESSION +        use Rack::Session::Cookie,  :key=>Zorglub::Config.session_key, :secret=>Zorglub::Config.session_secret, +            :path=>'/', :http_only=>true, :expire_after=>30 +    end      run APP  end  # diff --git a/example/view/url3/index.haml b/example/view/url3/index.haml index 789cf16..f5974d7 100644 --- a/example/view/url3/index.haml +++ b/example/view/url3/index.haml @@ -1,6 +1,5 @@  %h2=@title  %p=Time.now.strftime '%H:%M:%S' -%p="SID : #{@sid}"  %p="Session data : #{@data}"  %a{:href=>Node3.r}="reload"  %br  | 
