Skip to content
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

Set belongs_to_required_by_default = false #1807

Merged
merged 1 commit into from
Mar 30, 2017

Conversation

jhawthorn
Copy link
Contributor

As of Rails 5, belongs_to is now required by default. Our models, including those in extensions and applications, aren't ready for this.

In Rails 5.0 there seems to be some bug that was preventing this new default from affecting Spree::Base models.

> Spree::Base.belongs_to_required_by_default
=> nil
> config.active_record.belongs_to_required_by_default
=> true

In Rails 5.1 this seems to be fixed so we need to be explicit about what we use. We might as well be explicit in Rails 5.0 anyways.

cc @tvdeyen

As of Rails 5, belongs_to is now required by default. Our models,
including those in extensions and applications, aren't ready for this.

In Rails 5.0 there seems to be some bug that was preventing this new
default from affecting Spree::Base models.

    > Spree::Base.belongs_to_required_by_default
    => nil
    > config.active_record.belongs_to_required_by_default
    => true

In Rails 5.1 this seems to be fixed so we need to be explicit about what
we use. We might as well be explicit in Rails 5.0 anyways.
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Contributor

@cbrunsdon cbrunsdon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, glad we can set this on the base class.

@jhawthorn jhawthorn merged commit ebe5c47 into solidusio:master Mar 30, 2017
@jhawthorn jhawthorn added this to the Rails 5.1 milestone Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants