Skip to content

Move Date/Number Helpers to ActiveSupport #3214

Closed
yfeldblum opened this Issue Oct 4, 2011 · 10 comments

8 participants

@yfeldblum

The following helpers apply beyond ActionView, and should be moved to ActiveSupprt - potentially as instance methods patches on the respective classes.

ActionView::Helpers::DateHelper
  #distance_of_time_in_words
  #time_ago_in_words
  #distance_of_time_in_words_to_now

ActionView::Helpers::NumberHelper
  (all)
@isaacsanders

@yfeldblum Is this still an issue?

@yfeldblum

Yes, this is a feature request that

  1. these helper modules be available without depending on ActionView
  2. these helper modules be included into the corresponding core classes

These modules & methods have everything to do with formatting numbers and datetimes as strings, which is the province of ActiveSupport, and nothing to do with locating and rendering templates, which is the province of ActionView.

@yfeldblum

These modules & methods are useful outside of ActionView templates, such as in model, job, service, validator, & controller classes.

@isaacsanders

Do you think you could create a patch? If not, do you know where the code for this would be?

@rafaelfranca rafaelfranca was assigned Apr 30, 2012
@amutz
amutz commented May 15, 2012

I've written a patch for NumberHelper and submitted a pull request:

#6315

If you are also interested in the same for DateHelper, I can do that as well.

Thanks,
Andrew.

@yfeldblum

Please do!

@steveklabnik
Ruby on Rails member

Mentioning #6315 explicitly so GitHub links the two.

@arunagw
Ruby on Rails member
arunagw commented May 26, 2012

Closing this in favor of #6315. We are already having discussion over there.

@arunagw arunagw closed this May 26, 2012
@tuexss
tuexss commented Oct 8, 2015

So, the number helpers were moved. I'd +1 to also move the date helpers. wdyt?

@sparksp
sparksp commented Dec 2, 2015

@amutz did you get anywhere with doing the same for DateHelper as you did in #6315 for NumberHelper? Best I can tell it still exists in ActionView

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.