Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix 'no implicit conversion from nil to integer' error #1

Merged
merged 2 commits into from Mar 7, 2012
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Split
@@ -36,7 +36,7 @@ def mass_assignment?
# Note that 'attr_accessible' must be preceded by nothing other than
# whitespace; this catches cases where attr_accessible is commented out.
def attr_accessible?
- model = "#{RAILS_ROOT}/app/models/#{self.underscore}.rb"
+ model = "#{Rails.root}/app/models/#{self.underscore}.rb"
if File.exist?(model)
return @@cache[model] unless @@cache[model].nil?
@@cache[model] = File.open(model).read =~ /^\s*attr_accessible/
@@ -86,8 +86,8 @@ def self.print_mass_assignment_problems(controller)
# and then run
# $ chmod +x git/hooks/pre-commit
def self.find
- controllers = Dir.glob("#{RAILS_ROOT}/app/controllers/**/*_controller.rb")
exit_status = 0
+ controllers = Dir.glob("#{Rails.root}/app/controllers/**/*_controller.rb")
controllers.each do |controller|
if controller.mass_assignment_problem?
puts "\n#{controller}"