trek / exposure
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Wed Oct 21 22:27:13 -0700 2009 | |
| |
NOTES | Wed Oct 21 21:02:00 -0700 2009 | |
| |
README.mdown | ||
| |
Rakefile | Mon Oct 26 15:42:49 -0700 2009 | |
| |
VERSION | ||
| |
lib/ | ||
| |
script/ | Fri Oct 02 16:54:38 -0700 2009 | |
| |
spec/ | ||
| |
tasks/ | Fri Oct 02 16:54:38 -0700 2009 |
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_findafter_findafter_find_on_failureafter_find_on_successbefore_assignafter_assignbefore_saveafter_saveafter_save_on_failureafter_save_on_successbefore_createafter_create_on_failureafter_create_on_successbefore_updateafter_update_on_failureafter_update_on_successbefore_destroyafter_destroy_on_successbefore_responsebefore_response_on_successbefore_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.

