Rails 3: Disable session cookies

后端 未结 4 1244
离开以前
离开以前 2021-02-05 14:09

I created a controller to serve dynamic stylesheets, so I can use the image_tag helper and add some cache control.

The problem is that every time the css file is loaded

相关标签:
4条回答
  • 2021-02-05 14:13

    Simply done by setting the session_store to :disabled like so:

    MyApp::Application.config.session_store :disabled
    

    That will completely disable the session as well as access to the flash.

    0 讨论(0)
  • 2021-02-05 14:13

    Here's an alternate way in 2.3 to disable sessions, by setting the session store to nil:

    http://johnpwood.net/2009/09/04/disabling-sessions-in-rails-2-3-4/

    Perhaps you can do the same in 3?

    0 讨论(0)
  • 2021-02-05 14:28

    or one can use session :off anyways (even in Rails 3) :

    https://github.com/kares/session_off

    class StylesheetsController < ActionController::Base
      session :off # for all actions in this controller
    end
    
    0 讨论(0)
  • 2021-02-05 14:31

    In Rails 3 you could use ActiveControllerMetal and only include the features you need http://asciicasts.com/episodes/150-rails-metal

    0 讨论(0)
提交回复
热议问题