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

Use Rails 6.0 methods to simplify code #4881

Merged
merged 6 commits into from
Aug 24, 2022
Merged

Use Rails 6.0 methods to simplify code #4881

merged 6 commits into from
Aug 24, 2022

Conversation

javierm
Copy link
Member

@javierm javierm commented Jul 26, 2022

References

Objectives

  • Simplify existing code using features introduced in Rails 6.0
  • Remove one of our 102 gem dependencies (Database Cleaner)

.map { |date| I18n.l(date, format: :long) }
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a
.reject { |date| date == Time.zone.tomorrow }
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).excluding(Time.zone.tomorrow)

Choose a reason for hiding this comment

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

Layout/LineLength: Line is too long. [112/110] (https://rubystyle.guide#max-line-length)

Copy link
Member Author

Choose a reason for hiding this comment

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

It's shorter than it was 😉.

@javierm javierm force-pushed the rails_6.0 branch 2 times, most recently from 3bfe01c to d37289b Compare July 26, 2022 21:15
@javierm javierm force-pushed the rails_6.0 branch 3 times, most recently from 0fdfe02 to f7387b0 Compare August 24, 2022 12:37
Base automatically changed from rails_6.0 to master August 24, 2022 14:06
Consul Democracy automation moved this from Reviewing to Testing Aug 24, 2022
@taitus taitus self-requested a review August 24, 2022 15:18
@taitus taitus moved this from Testing to Reviewing in Consul Democracy Aug 24, 2022
Performance tests show both methods of truncating the database take
about the same time, so we can remove one dependency and we don't lose
anything in the process.
The `pick` method was added in Rails 6.0.
This is consistent with `with_frozen_time`.
This method was already available as #without, but we didn't know about
it.
They were introduced in Rails 6.0.
This method was introduced in Rails 6.0. It can be used to take an array
and create a hash where the elements of the array are the indexes of the
hash.
Consul Democracy automation moved this from Reviewing to Testing Aug 24, 2022
@javierm javierm merged commit 200e8fb into master Aug 24, 2022
Consul Democracy automation moved this from Testing to Release 1.6.0 Aug 24, 2022
@javierm javierm deleted the rails_6.0_methods branch August 24, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants