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

Compatibility with Rails 5.2.1 & Ransack #2826

Merged
merged 3 commits into from
Aug 28, 2018

Conversation

kennyadsl
Copy link
Member

@kennyadsl kennyadsl commented Aug 9, 2018

ref #2825

  • Update ransack dependency to make it work with Rails 5.2.1
  • Fix some specs
  • Lock monetize dependency since the new version does not work with our DistributedAmount calculator.

@kennyadsl
Copy link
Member Author

kennyadsl commented Aug 10, 2018

This is the issue on ransack that is making our spec fail, let's see what happen.

In the meantime ransack 2.0 has been released so I'm going to bump our dependency up in the core gemspec. This way Rails < 5.2 will use ransack 1.8 and Rails >= 5.2 will use ransack 2.0. Ransack 1.8 will not be used by any Solidus version since it's only for Rails < 5.0 and we do support Rails >= 5.1.

@kennyadsl kennyadsl force-pushed the ransack-rails-5.2.1 branch 2 times, most recently from 15e097d to 786f516 Compare August 10, 2018 12:26
Ransack 2.0.1 is the only version compatible with rails 5.2.1.

Rails < 5.0 is no more supported since it needs to use ransack 1.8.
This is not an issue since we are not supporting rails < 5.1 anyway.
I'm not sure why but previously the association was returning an
instance of ActiveRecord::Associations::CollectionProxy that was
considered not changed while reloading. Despite that `shipments`
call is still returning the same object, they now have a different
`object_id` and this could be the root of the problem.

I'm not sure if this issue raised up with Rails 5.2.1 or by using the
ransack master branch on github.
@huoxito
Copy link
Contributor

huoxito commented Aug 25, 2018

@kennyadsl see nebulab#15 that might help

that last spec failure might be related to a monetize version change. I noticed that latest master build was still Using activerecord 5.1.6 I tried to run the test on that version but it still failed. When I diff my local bundle with the one in circleci a monetize gem bump made me think it could be related.

I don't know yet whether it's a problem with the test setup or something wrong with monetize. It seems worth checking though, calculations shouldn't break like that.

This commit comes from @huoxito work on #15 (Thanks!)

On newer versions monetize requires money 6.12 which has a rewrite of
the Money#allocate method that we use in DistrubutedAmount calculator.

This is the PR that is causing issues: RubyMoney/money#772
This is the issue we need to be solved before relaxing the dependency
again: RubyMoney/monetize#118
@kennyadsl kennyadsl removed the WIP label Aug 27, 2018
Copy link
Member

@gmacdougall gmacdougall left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -35,9 +35,9 @@ Gem::Specification.new do |s|
s.add_dependency 'discard', '~> 1.0'
s.add_dependency 'friendly_id', '~> 5.0'
s.add_dependency 'kaminari-activerecord', '~> 1.1'
s.add_dependency 'monetize', '~> 1.1'
s.add_dependency 'monetize', '~> 1.8.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor suggestion would be to add a comment as to why this is locked with a link to the issue that needs to be resolved until it can be relaxed again.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, I've documented that in the commit message. I prefer not to add comments in the code and if we forgot and keep monetize locked to 1.8 is not that critical. If someone will need to update monetize to 1.9 a git blame will document the why of this. Does it make sense?

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

@tvdeyen tvdeyen merged commit 8a58bc5 into solidusio:master Aug 28, 2018
@kennyadsl kennyadsl deleted the ransack-rails-5.2.1 branch September 12, 2018 21:58
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.

5 participants