Skip to content

Instantly share code, notes, and snippets.

@iamvery
Created May 10, 2012 14:32
Show Gist options
  • Select an option

  • Save iamvery/2653429 to your computer and use it in GitHub Desktop.

Select an option

Save iamvery/2653429 to your computer and use it in GitHub Desktop.
Issue I ran into upgrading rails 3.0 app to 3.2
has_many :related_whatevers,  :through => :whatever_relations,   :source => :related_whatever, :class_name => 'Whatever'

gives error

NameError: uninitialized constant WhateverRelationship::RelatedWhatever

when I try to add a "related_whatever". It seems to be ignoring the class_name option. This works fine under rails 3.0. Is it me or is this some kind of bug?


FYI, I solved this problem by moving the class_name up to the WhateverRelationship model rather than specifying it in the related_whatevers association. Not sure why it worked in 3.0 and not 3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment