- 的Ruby 1.9.2
- 的Rails 3.1.10
这是我的代码:
class Report::ExpectedHour
def initialize(user, options = {})
@user = user
@date_start = options[:start]
@date_end = options[:end]
end
def expected_hours_range
previous = ExpectedHour.previous_dates(@user, @date_start).first
hours_range = ExpectedHour.between_dates(@user, @date_start, @date_end)
unless hours_range.include?(previous)
hours_range << previous
end
hours_range
end
end
每次我打电话expected_hours_range
从我的实例我得到这个错误:
NameError: uninitialized constant Report::ExpectedHour::ExpectedHour
from /home/edelpero/.rvm/gems/[email protected]/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library'
from /opt/lampp/htdocs/titi/app/models/report/expected_hour.rb:10:in `expected_hours_range'
我不确定为什么Report::ExpectedHour::ExpectedHour
被调用,因为我打电话ExpectedHour
这是一个实际存在的ActiveRecord类。另外Report::ExpectedHour::ExpectedHour
不存在。
前缀: – 2013-02-13 14:13:10