-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Rails 5.1 defaults in dummy app
This enables the belongs_to_required_by_default option. Add "optional: true" where necessary to fix spec failures caused by this. This will enable users of PaperTrail, who also use the Rails 5.1 defaults, to not see exceptions caused by "item" being required by VersionConcern, such as when using soft deletion.
- Loading branch information
Joel Hayhurst
committed
Aug 24, 2017
1 parent
0e95bda
commit d404d7f
Showing
6 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
class Fluxor < ActiveRecord::Base | ||
belongs_to :widget | ||
if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
belongs_to :widget, optional: true | ||
else | ||
belongs_to :widget | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
class Whatchamajigger < ActiveRecord::Base | ||
has_paper_trail | ||
belongs_to :owner, polymorphic: true | ||
|
||
if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
belongs_to :owner, polymorphic: true, optional: true | ||
else | ||
belongs_to :owner, polymorphic: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters