trek / exposure

exposed resources

This URL has Read+Write access

name age message
file .gitignore Wed Oct 21 22:27:13 -0700 2009 ignore built packages [trek]
file NOTES Wed Oct 21 21:02:00 -0700 2009 * doc fixes. * implemented :only/:except option... [trek]
file README.mdown Loading commit data...
file Rakefile Mon Oct 26 15:42:49 -0700 2009 moved to jewler/gemcutter for gem [trek]
file VERSION
directory lib/
directory script/ Fri Oct 02 16:54:38 -0700 2009 moved to github [trek]
directory spec/
directory tasks/ Fri Oct 02 16:54:38 -0700 2009 moved to github [trek]
README.mdown

exposure

Exposure is a Rails is a controller abstraction layer like resource_this, make_resourceful and resource_controller with the same goal: exposing resources at the controller level with fewer headaches.

class PostsController < ApplicationController
  expose :posts
end

Customization:

Exposure has a number of customization points:

Callbacks

Exposure uses ActiveSupport's callback system and has the following callbacks:

  • before_find
  • after_find
  • after_find_on_failure
  • after_find_on_success
  • before_assign
  • after_assign
  • before_save
  • after_save
  • after_save_on_failure
  • after_save_on_success
  • before_create
  • after_create_on_failure
  • after_create_on_success
  • before_update
  • after_update_on_failure
  • after_update_on_success
  • before_destroy
  • after_destroy_on_success
  • before_response
  • before_response_on_success
  • before_response_on_failure

You can access these directly

class PostsController
  before_find :do_somethng_special, :if => {|c| c.action_name == 'show' }
  private
    def do_somethng_special
      ...
    end
end

or through a specialty syntax

class PostsController
  before :find, :do_somethng_special, :only => [:create]
  private
    def do_somethng_special
      ...
    end
end

Finders

Flashers

Responders

INSTALL:

$ sudo gem install exposure

# environment.rb
gem.exposure

LICENSE:

(The MIT License)

Copyright (c) 2009 Trek Glowacki

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.