Module: ActiveRecordAssociationsModuleName
- Includes:
- BuilderExtension
- Defined in:
- lib/active_record_associations_module_name.rb,
lib/active_record_associations_module_name/version.rb
Overview
When working with ActiveRecord models within modules, retyping the module path within association definitions becomes repetitive. These extensions add a module_name option to AR-associations. You can specify a string that will be prepended to the definition’s class_name option, or you can just say true to use the caller’s module.
Example:
class Blog::Post
has_many :comments, module_name: true
# this replaces:
# has_many :comments, class_name: "Blog::Comment"
end
Defined Under Namespace
Modules: AssociationClassMethodExtension, BuilderExtension
Constant Summary collapse
- VERSION =
'0.1.0'