It would be great to have helpers like linkTo()
, truncate()
, and pluralize()
in Javascript. Have there been any efforts to port some or all of Rails' view helpers to Javascript?
Asked
Active
Viewed 104 times
4

Adam Singer
- 2,377
- 3
- 18
- 18
-
Myself, I’d love to see the functions for formatting numbers (with delimiters or like “55.2M”) – Alan H. May 16 '12 at 00:08
1 Answers
2
If you just need one or two, you can find snippets for pluralize and singularize or another for truncating.
And actually, there's now a javascript library that handles a lot of the syntactic sugar:
Like I said in my original post, no need to include a whole library if you only want one or two of them or can manage to just use the Rails helpers, but the option to have them is out there.

Kelly
- 40,173
- 4
- 42
- 51
-
`truncate` and `pluralize` are probably bad examples if you want to argue they would hurt load time significantly. Those are pretty tiny, unless of course we are assuming there’s also a large embedded list of known irregular plurals… in which case, we’re in agreement – Alan H. May 16 '12 at 00:07