Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kaorukobo/2988479 to your computer and use it in GitHub Desktop.
Save kaorukobo/2988479 to your computer and use it in GitHub Desktop.
Hack for ActiveRecord: to avoid "NameError: uninitialized constant" on Rails-3.1.3 + active_scaffold 3.* (append parent module name to association's class_name)
class ActiveRecord::Reflection::AssociationReflection
def derive_class_name
cn = ""
parent = active_record.parent
unless parent == Object
cn << "#{parent.name}::"
end
cn << name.to_s.camelize
cn = cn.singularize if collection?
cn
end
end
@kaorukobo
Copy link
Author

"NameError: uninitialized constant" on Rails-3.1.3 + active_scaffold 3.*": https://gist.github.com/1663895

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