Skip to content

hosh/intermodal-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

== Intermodal

Vendored (git submodule) installation

Base Rails command:

rails new intermodal-example -d postgresql -S -J -T --skip-bundle

- No Sprockets
- No Javascript
- No Test::Unit

(1) Install Intermodal

    git submodule add git://github.com/hosh/intermodal.git vendor/gems/intermodal

Edit Gemfile:

    gem :intermodal, :path => 'vendor/gems/intermodal'

Run Bundler

    bundle

(2) Generate account models

    rails generate model account name:string
    rails generate model access_credential identity:string account_id:integer

    class Account < ActiveRecord::Base
      include Intermodal::Models::Account
    end

    class AccessCredential < ActiveRecord::Base
      include Intermodal::Models::AccessCredential
    end

TODO: Turn this into a rails generator, rails generate intermodal:accounts
TODO: Add RSpec macros for Account and AccessCredential models

(3) Generate access token model

    class AccessToken
      include Intermodal::Models::AccessToken
    end

You will need to establish a connection (defaults to localhost):

    AccessToken.establish_connection!

TODO: Move this into a Rack session middleware

(4) Disable Rack::Lock from the default middleware stack

TODO: Figure out why this is not working for Rails 3.1
TODO: Document the easiest method to remove Rack::Lock

(5) Disable ActiceRecord::QueryCache

ActiveRecord 3.1 inserts a Rack middleware for managing query caches
Since there is no configuration to actually disable it, then this kludge
comes in later to remove it from the stack.

QueryCaching needs to be disabled so that the tests work. It remains to be
seen if the tests can be rewritten with QueryCache in mind. I have not
tested this in server mode yet.

    # Insert this into your application.rb file
    initializer 'intermodal_example.hack_active_record', :after => 'eager_load!' do
      config.middleware.delete ActiveRecord::QueryCache
    end

TODO: Pull request to Rails 
TODO: Figure out the real reason this is happening
TODO: Test externally to see if Intermodal will work with query cache

About

Example Rails 3.1 / Ruby 1.9.2 application for Intermodal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors