Permalink
Browse files

Adding optional env['rack.lilypad.action'] and env['rack.lilypad.comp…

…onent'] to manually specify action and controller (for Rails), version bump (0.2.1)
  • Loading branch information...
1 parent 17fa3cc commit 85dafe357abc4233efbdf9c853032522b17c998e @winton committed Dec 2, 2009
Showing with 8 additions and 3 deletions.
  1. +2 −0 README.markdown
  2. +1 −1 gemspec.rb
  3. +3 −2 lib/rack/lilypad.rb
  4. +2 −0 spec/fixtures/rails/app/controllers/application_controller.rb
View
2 README.markdown
@@ -31,6 +31,8 @@ class ApplicationController < ActionController::Base
def rescue_action(exception)
super
+ request.env['rack.lilypad.component'] = params[:controller]
+ request.env['rack.lilypad.action'] = params[:action]
raise exception
end
end
View
2 gemspec.rb
@@ -14,5 +14,5 @@
s.name = GEM_NAME
s.platform = Gem::Platform::RUBY
s.require_path = "lib"
- s.version = "0.2.0"
+ s.version = "0.2.1"
end
View
5 lib/rack/lilypad.rb
@@ -31,7 +31,7 @@ def call(env)
class Hoptoad
- def initialize(api_key, filters, log)
+ def initialize(api_key, filters=[], log=false)
@api_key = api_key
@filters = filters
@log = log
@@ -109,7 +109,8 @@ def xml(exception, env)
end
end
n.request do |r|
- r.component request_path
+ r.action environment['rack.lilypad.action']
+ r.component environment['rack.lilypad.component'] || request_path
r.url request_path
if request.params.any?
r.params do |p|
View
2 spec/fixtures/rails/app/controllers/application_controller.rb
@@ -10,6 +10,8 @@ class ApplicationController < ActionController::Base
def rescue_action(exception)
super
+ request.env['rack.lilypad.component'] = params[:controller]
+ request.env['rack.lilypad.action'] = params[:action]
raise exception
end

0 comments on commit 85dafe3

Please sign in to comment.