Permalink
Browse files

move things around so it works with rails

  • Loading branch information...
mkristian committed Mar 20, 2012
1 parent ed5fc4d commit efc6936cd24948031402609fc6819043fc8b9a67
Showing with 5 additions and 6 deletions.
  1. +2 −1 Mavenfile
  2. +1 −1 lib/ixtlan/guard/guard_rails.rb
  3. +1 −3 lib/ixtlan/guard/railtie.rb
  4. +1 −1 spec/guard_rails_spec.rb
View
@@ -1,2 +1,3 @@
-properties['jruby.versions']='1.6.3,1.6.4,1.5.6,1.6.5'
+properties['jruby.versions']='1.5.6,1.6.3,1.6.4,1.6.5.1,1.6.6,1.6.7'
properties['jruby.18and19']='true'
+properties['jruby.plugins.version']='0.28.6'
@@ -199,7 +199,7 @@ def self.included(base)
end
module InstanceMethods #:nodoc:
- def allowed?(action, resource, reference = nil)
+ def allowed?(resource, action, reference = nil)
if resource.to_s != controller.class.controller_name || reference
other = "#{resource}Controller".classify.constantize
if other.respond_to?(:allowed?)
@@ -12,6 +12,7 @@ class Railtie < Rails::Railtie
app.config.guards_dir = File.join(Rails.root, "app", "guards")
# needs to be here ?!?
::ActionController::Base.send(:include, Ixtlan::Guard::ActionController)
+ ::ActionView::Base.send(:include, Ixtlan::Guard::Allowed)
end
config.after_initialize do |app|
@@ -25,9 +26,6 @@ class Railtie < Rails::Railtie
controller = ::ApplicationController rescue ::ActionController::Base
controller.send(:before_filter, :authorize)
-
- helper = ::ApplicationHelper rescue ::ActionView::Base
- helper.send(:include, Ixtlan::Guard::Allowed)
app.config.guard = Ixtlan::Guard::Guard.new(options)
end
View
@@ -7,7 +7,7 @@ def debug(&block)
end
end
-class Rails
+module Rails
def self.application
self
end

0 comments on commit efc6936

Please sign in to comment.