Changeset 1047

Show
Ignore:
Timestamp:
11/25/07 15:22:58 (1 year ago)
Author:
e.@brainspl.at
Message:

doc patch closes #330

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/abstract_controller.rb

    r967 r1047  
    113113      return :filter_chain_completed 
    114114    end  
    115    
    116     def finalize_session 
     115     
     116    # +finalize_session+ is called at the end of a request to finalize/store any data placed in the session. 
     117    # Mixins/Classes wishing to define a new session store must implement this method. 
     118    # See merb/lib/sessions/* for examples of built in session stores. 
     119     
     120    def finalize_session #:nodoc: 
    117121      # noop 
    118122    end   
    119        
    120     def setup_session 
     123 
     124    # +setup_session+ is called at the beginning of a request to load the current session data. 
     125    # Mixins/Classes wishing to define a new session store must implement this method. 
     126    # See merb/lib/sessions/* for examples of built in session stores. 
     127     
     128    def setup_session #:nodoc: 
    121129      # noop 
    122130    end 
  • trunk/lib/merb/controller.rb

    r1017 r1047  
    77  # to your controller via params. It also parses the ?query=string and 
    88  # puts that into params as well. 
     9  # 
     10  # == Sessions 
     11  #  
     12  # Session data can be accessed through the +session+ hash: 
     13  # 
     14  #   session[:user_id] = @user.id 
     15  # 
     16  # Session data is available until the user's cookie gets deleted/expires, 
     17  # or until your specific session store expires the data. 
     18  # 
     19  # === Session Store 
     20  # 
     21  # The session store is set in MERB_ROOT/config/merb.yml : 
     22  # 
     23  #   :session_store: your_store 
     24  # 
     25  # Out of the box merb supports three session stores 
     26  # 
     27  # cookie:: All data (max 4kb) stored directly in cookie.  Data integrity is checked on each request to prevent tampering. (Merb::CookieStore) 
     28  # memory:: Data stored in a class in memory. (Merb::MemorySession) 
     29  # mem_cache:: Data stored in mem_cache. (Merb::MemCacheSession) 
     30  # 
     31  # See the documentation on each session store for more information. 
     32  # 
     33  # You can also use a session store provided by a plugin.  For instance, if you have DataMapper you can set 
     34  # 
     35  #   :session_store: datamapper 
     36  # 
     37  # In this case session data will be stored in the database, as defined by the merb_datamapper plugin. 
     38  # Similar functionality exists for +activerecord+ and +sequel+ currently. 
     39   
    940  class Controller < AbstractController 
    1041    class_inheritable_accessor :_session_id_key, :_session_expiry 
  • trunk/lib/merb/mixins/web_controller.rb

    r490 r1047  
     1# Used by secondary actions (a PartsController or the view) 
     2# to provide the standard objects associated with each request. 
     3 
    14module Merb 
    2   module WebControllerMixin 
     5  module WebControllerMixin #:nodoc: 
    36     
    47    def request 
  • trunk/lib/merb/session/cookie_store.rb

    r1010 r1047  
    66module Merb 
    77   
    8   module SessionMixin 
     8  module SessionMixin #:nodoc: 
    99    def setup_session 
    1010      MERB_LOGGER.info("Setting Cookie Store Sessions") 
     
    1515    end 
    1616     
    17     def finalize_session       
     17    def finalize_session 
    1818      MERB_LOGGER.info("Finalize Cookie Store Session") 
    1919      if request.session.modified? 
     
    3434  # 
    3535  # A message digest is included with the cookie to ensure data integrity: 
    36   # a user cannot alter his user_id without knowing the secret key included in 
    37   # the hash.  
     36  # a user cannot alter session data without knowing the secret key included 
     37  # in the hash.  
    3838  #  
    3939  # To use Cookie Sessions, set in config/merb.yml 
    4040  #  :session_secret_key - your secret digest key 
    41   #  :cookie_store_session - to tru
     41  #  :session_store: cooki
    4242  class CookieStore 
    4343    # TODO (maybe): 
  • trunk/lib/merb/session/mem_cache_session.rb

    r829 r1047  
    33module Merb 
    44 
    5   module SessionMixin 
     5  module SessionMixin #:nodoc: 
    66 
    77    def setup_session 
  • trunk/lib/merb/session/memory_session.rb

    r829 r1047  
    11module Merb 
    22   
    3   module SessionMixin 
     3  module SessionMixin #:nodoc: 
    44 
    55    def setup_session 
     
    1919    end 
    2020  end 
     21   
     22  ## 
     23  # Sessions stored in memory. 
     24  # 
     25  # And a setting in +merb.yml+: 
     26  # 
     27  #   :session_store: mem_cache 
     28  #   :memory_session_ttl: 3600 (in seconds, one hour) 
     29  # 
     30  # Sessions will remain in memory until the server is stopped or the time 
     31  # as set in :memory_session_ttl expires. 
    2132   
    2233  class MemorySession