Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make belongs_to :class optional (comply with Rails 5) #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
huacnlee merged 1 commit into rails-engine:master from joaumg:master
Jul 16, 2017
Merged

Make belongs_to :class optional (comply with Rails 5) #9

huacnlee merged 1 commit into rails-engine:master from joaumg:master
Jul 16, 2017

Conversation

@joaumg
Copy link
Contributor

@joaumg joaumg commented Jul 16, 2017

belongs_to will now trigger a validation error by default if the association is not present (rails/rails#18937).

This breaks the possibility of creating a Notification without targets, such as:

Notification.create(notify_type: 'follow', actor: self, user: user)

This can be fixed either by adding optional: true in the Model (this PR), or changing Rails.application.config.active_record.belongs_to_required_by_default to false in dev's apps.

Copy link

codecov bot commented Jul 16, 2017

Codecov Report

Merging #9 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@
## master #9 +/- ##
======================================
 Coverage 93.4% 93.4% 
======================================
 Files 7 7 
 Lines 91 91 
======================================
 Hits 85 85 
 Misses 6 6
Impacted Files Coverage Δ
lib/notifications/model.rb 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e518b99...69793f1. Read the comment docs.

@huacnlee huacnlee merged commit 8345c61 into rails-engine:master Jul 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /