Skip to content

Instantly share code, notes, and snippets.

@cmrichards
Created November 26, 2010 02:03
Show Gist options
  • Save cmrichards/716190 to your computer and use it in GitHub Desktop.
Save cmrichards/716190 to your computer and use it in GitHub Desktop.
Strange Error
module Trans
end
class Job < ActiveRecord::Base
has_many :job_translations
has_many :default_job_translations, :through => :job_translations
end
class DefaultJobTranslation < ActiveRecord::Base
named_scope :forum, where(:group=>"forum")
end
class JobTranslation < ActiveRecord::Base
belongs_to :default_job_translation
include Trans <---- If I remove this line then the below error does not occur
end
job = Job.find 4
job.default_job_translations <--- this causes error
NameError: uninitialized constant Job::JobTranslation
from /home/chrisr/.rvm/gems/ruby-1.8.7-head/gems/activerecord-3.0.1/lib/active_record/base.rb:1201:in `compute_type'
from /home/chrisr/.rvm/gems/ruby-1.8.7-head/gems/activerecord-3.0.1/lib/active_record/reflection.rb:162:in `send'
from /home/chrisr/.rvm/gems/ruby-1.8.7-head/gems/activerecord-3.0.1/lib/active_record/reflection.rb:162:in `klass'
from /home/chrisr/.rvm/gems/ruby-1.8.7-head/gems/activerecord-3.0.1/lib/active_record/reflection.rb:338:in `source_reflection'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment