github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jbarnette / intercession

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 56
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (2)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (2)
    • v2.0.0
    • v1.0.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Your session loves you. Treat her like a lady. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Prep for v2.0.0. 
jbarnette (author)
Mon Sep 28 15:43:35 -0700 2009
commit  a5264ebdfc14467fbb97c8fdde1228ae42c4b986
tree    01e9b2d1390bf9d6bcce4bb149af4daa34937174
parent  909c224476c122e9df060f4e5cc33afd25d6cd57
intercession /
name age
history
message
file .gitignore Loading commit data...
file CHANGELOG.rdoc Mon Sep 28 15:43:35 -0700 2009 Prep for v2.0.0. [jbarnette]
file Manifest.txt
file README.rdoc
file Rakefile Mon Sep 28 15:41:30 -0700 2009 Simplify. Support Rails 2.3.4. [jbarnette]
file install.rb
directory lib/
file session.template
README.rdoc

Intercession

  • github.com/jbarnette/intercession

Description

Treat your sessions like models, not hashes. Intercession mixes a module into the session on each request, allowing you to nicely encapsulate (and test!) lots of user and session-specific behavior.

Examples

Check out this gist: gist.github.com/44506

Unit tests for your session model! Mix it in to a Hash and go to town:

    def setup
      @session = Hash.new
      @session.extend Transient::Session
    end

    def test_session_user_lazily_loads_from_user_id
      assert_nil @session.user
      @session[:user_id] = users(:default).id
      assert_equal users(:default), @session.user
    end

Installation

I’ve used Intercession with Rails v2.2.2 and v2.3.4. Anything else might give you hives.

Intercession works as a plugin or a gem. If you install it as a plugin, it’ll create you a stub session module in app/models/transient/session.rb. If you’re using it as a gem, do it yourself. :)

As a plugin:

    $ script/plugin install git://github.com/jbarnette/intercession.git

As a gem (preferred):

    $ gem install intercession

If you’re using Intercession as a gem, add it to your app’s gem dependency mechanism.

After installation, add include Intercession to your ApplicationController. To enable Intercession in your tests, call Intercession.test! in your test_helper.rb.

License

Copyright 2009 John Barnette (jbarnette@rubyforge.org)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server