Skip to content

Commit

Permalink
Less deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stffn committed Apr 18, 2010
1 parent ede7488 commit c459a26
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/controllers/authorization_rules_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AuthorizationRulesController < ApplicationController
def index
respond_to do |format|
format.html do
@auth_rules_script = File.read("#{RAILS_ROOT}/config/authorization_rules.rb")
@auth_rules_script = File.read("#{::Rails.root}/config/authorization_rules.rb")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/declarative_authorization/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AuthorizationUsageError < AuthorizationError ; end
# The exception is raised to ensure that the entire rule is invalidated.
class NilAttributeValueError < AuthorizationError; end

AUTH_DSL_FILES = ["#{RAILS_ROOT}/config/authorization_rules.rb"] unless defined? AUTH_DSL_FILES
AUTH_DSL_FILES = ["#{Rails.root}/config/authorization_rules.rb"] unless defined? AUTH_DSL_FILES

# Controller-independent method for retrieving the current user.
# Needed for model security where the current controller is not available.
Expand All @@ -40,7 +40,7 @@ def self.ignore_access_control (state = nil) # :nodoc:
end

def self.activate_authorization_rules_browser? # :nodoc:
::RAILS_ENV == 'development'
::Rails.env.development?
end

@@dot_path = "dot"
Expand Down
4 changes: 2 additions & 2 deletions lib/declarative_authorization/maintenance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ module Usage
def self.usages_by_controller
# load each application controller
begin
Dir.foreach(File.join(RAILS_ROOT, %w{app controllers})) do |entry|
Dir.foreach(File.join(::Rails.root, %w{app controllers})) do |entry|
if entry =~ /^\w+_controller\.rb$/
require File.join(RAILS_ROOT, %w{app controllers}, entry)
require File.join(::Rails.root, %w{app controllers}, entry)
end
end
rescue Errno::ENOENT
Expand Down
14 changes: 7 additions & 7 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
File.join(File.dirname(__FILE__), %w{.. .. .. ..})
end

DA_ROOT = Pathname.new(File.expand_path("..", File.dirname(__FILE__)))

require DA_ROOT + File.join(%w{lib declarative_authorization rails_legacy})
require DA_ROOT + File.join(%w{lib declarative_authorization authorization})
require DA_ROOT + File.join(%w{lib declarative_authorization in_controller})
require DA_ROOT + File.join(%w{lib declarative_authorization maintenance})

unless defined?(ActiveRecord)
if File.directory? RAILS_ROOT + '/config'
puts 'Using config/boot.rb'
Expand All @@ -34,6 +27,13 @@
end
end

DA_ROOT = Pathname.new(File.expand_path("..", File.dirname(__FILE__)))

require DA_ROOT + File.join(%w{lib declarative_authorization rails_legacy})
require DA_ROOT + File.join(%w{lib declarative_authorization authorization})
require DA_ROOT + File.join(%w{lib declarative_authorization in_controller})
require DA_ROOT + File.join(%w{lib declarative_authorization maintenance})

begin
require 'ruby-debug'
rescue MissingSourceFile; end
Expand Down

0 comments on commit c459a26

Please sign in to comment.