add upgrade note for breaking habtm change in 3.2 -> 4.0
The has_and_belongs_to_many default join_table behavior changed
between Rails 3.2 and Rails 4.0 and should be noted in the
appropriate section of the upgrade guide.
commit:
46492949b8
This commit is contained in:
parent
2e7fd4a866
commit
78c4e30c6d
@ -883,6 +883,18 @@ this gem such as `whitelist_attributes` or `mass_assignment_sanitizer` options.
|
||||
|
||||
* To re-enable the old finders, you can use the [activerecord-deprecated_finders gem](https://github.com/rails/activerecord-deprecated_finders).
|
||||
|
||||
* Rails 4.0 has changed to default join table for `has_and_belongs_to_many` relations to strip the common prefix off the second table name. Any existing `has_and_belongs_to_many` relationship between models with a common prefix must be specified with the `join_table` option. For example:
|
||||
|
||||
```ruby
|
||||
CatalogCategory < ActiveRecord::Base
|
||||
has_and_belongs_to_many :catalog_products, join_table: 'catalog_categories_catalog_products'
|
||||
end
|
||||
|
||||
CatalogProduct < ActiveRecord::Base
|
||||
has_and_belongs_to_many :catalog_categories, join_table: 'catalog_categories_catalog_products'
|
||||
end
|
||||
```
|
||||
|
||||
### Active Resource
|
||||
|
||||
Rails 4.0 extracted Active Resource to its own gem. If you still need the feature you can add the [Active Resource gem](https://github.com/rails/activeresource) in your Gemfile.
|
||||
|
Loading…
Reference in New Issue
Block a user