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

Add patch for Rails 5.2.x #31

Merged
merged 13 commits into from
Apr 11, 2018
Merged

Add patch for Rails 5.2.x #31

merged 13 commits into from
Apr 11, 2018

Conversation

n-rodriguez
Copy link
Contributor

No description provided.

@n-rodriguez n-rodriguez changed the title Test with latest Rails versions Add patch for Rails 5.2.x Nov 30, 2017
@johndobrien
Copy link

It would be wonderful if this could be accepted.

@n-rodriguez
Copy link
Contributor Author

@jonkessler
Hi! Rails 5.2 is out :) http://weblog.rubyonrails.org/
I think we could drop support of Rails 4.0.x and 4.1.x in this new release. What do you think?

@bboe bboe self-requested a review April 10, 2018 22:35
@bboe
Copy link
Contributor

bboe commented Apr 10, 2018

Given the addition of the polymorphic_name method, I'm wondering if this package is even necessary in rails5. Or to ease transition, perhaps we need only overwrite that method going forward.

https://github.com/rails/rails/blob/d35875b7a3f559155a9378cbe9203b0b8ea580f9/activerecord/lib/active_record/inheritance.rb#L159

@n-rodriguez
Copy link
Contributor Author

Given the addition of the polymorphic_name method, I'm wondering if this package is even necessary in rails5

yeah... wondering the same

@n-rodriguez
Copy link
Contributor Author

@bboe
Copy link
Contributor

bboe commented Apr 10, 2018

@n-rodriguez would you consider updating your pull request such that for rails 5.2 only the polymorphic_name method is updated? It'd be nice to know that all the tests pass with such a simple change. In a subsequent pull request we could even go so far as to output a deprecation warning suggesting how to make it so this gem isn't necessary.

Thanks again for the efforts!

@n-rodriguez
Copy link
Contributor Author

I'm on it ;)

@n-rodriguez
Copy link
Contributor Author

2 tests are broken :

  1) Failure:
TestStoreBaseStiClass#test_polymorphic_has_many_through_with_double_sti_on_join_model [/home/nicolas/PROJECTS/GITHUB/store_base_sti_class/test/test_store_base_sti_class.rb:145]:
Expected: "SpecialPost"
  Actual: "Post"

  2) Failure:
TestStoreBaseStiClass#test_has_many_through_polymorphic_has_one [/home/nicolas/PROJECTS/GITHUB/store_base_sti_class/test/test_store_base_sti_class.rb:116]:
--- expected
+++ actual
@@ -1 +1 @@
-[#<Tagging id: 14, tag_id: 20, polytag_id: nil, polytag_type: nil, taggable_type: "Post", taggable_id: 21>, #<Tagging id: 15, tag_id: 20, polytag_id: nil, polytag_type: nil, taggable_type: "SpecialPost", taggable_id: 22>]
+[#<Tagging id: 14, tag_id: 20, polytag_id: nil, polytag_type: nil, taggable_type: "Post", taggable_id: 21>]

@bboe
Copy link
Contributor

bboe commented Apr 10, 2018

2 tests are broken

Thanks for looking into that. Can we isolate the changes that are needed to get those to work?

Rails 5.2.0 introduces a new method on ActiveRecord classes: '.polymorphic_name'.
This method helps us a lot for what we're doing with this gem.
However some patches are still needed tp make tests pass.
See https://github.com/rails/rails/blob/5-2-stable/activerecord/lib/active_record/inheritance.rb#L159
@n-rodriguez
Copy link
Contributor Author

Thanks for looking into that. Can we isolate the changes that are needed to get those to work?

Done!

@bboe
Copy link
Contributor

bboe commented Apr 11, 2018

Awesome. Taking a look. Edit, heading home. I'll take a look tomorrow morning. Thanks for the updates.

@bboe
Copy link
Contributor

bboe commented Apr 11, 2018

Thanks for submitting! You're awesome. 🎆

@bboe bboe merged commit 2e6838b into appfolio:master Apr 11, 2018
@n-rodriguez
Copy link
Contributor Author

You're welcome :)

@bboe
Copy link
Contributor

bboe commented Apr 11, 2018

Released 1.2.0.

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.

3 participants