Skip to content

Commit

Permalink
move things around so it works with rails
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Mar 20, 2012
1 parent ed5fc4d commit efc6936
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Mavenfile
@@ -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'
2 changes: 1 addition & 1 deletion lib/ixtlan/guard/guard_rails.rb
Expand Up @@ -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?)
Expand Down
4 changes: 1 addition & 3 deletions lib/ixtlan/guard/railtie.rb
Expand Up @@ -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|
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/guard_rails_spec.rb
Expand Up @@ -7,7 +7,7 @@ def debug(&block)
end
end

class Rails
module Rails
def self.application
self
end
Expand Down

0 comments on commit efc6936

Please sign in to comment.