A
A
Anton Misyagin2017-02-09 13:53:37
Ruby on Rails
Anton Misyagin, 2017-02-09 13:53:37

Are Cyrillic links possible on Rails?

Rail helpers (.._path, ..._url) that are associated with my Russian-language routes produce encoded links like:
%D0%BC%D0%BE%D0%B9%2F%D0%BF%D1%83%D1%82 %D1%8C%2F%D0%BD%D0%B0%2F%D0%BC%D0%BE%D0%B5%D0%BC%2F%D0%B3%D1%80%D0%B5%D0%B1 %D0%B0%D0%BD%D0%BE%D0%BC%2F%D1%81%D0%B0%D0%B9%D1%82%D0%B5
They put it in the browser, and it's even more depressing to see them when debugging in the console or rail logs.
And I want it to be in Russian. Is it possible and how? The option to skip all this through one more function is inconvenient, because the names of the helpers are different, the project is almost ready, and manually wrapping each such place into an additional function would be long and not samurai-style
Example:
favorites_url(:id => user.id)
Issued:

https://mysite.rf/favorites/54

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Misyagin, 2017-05-15
@sunnmas

config/initializers/string.rb

class String
  def ru
  	CGI::unescape(self)
  end
end

True, I had to change the code everywhere:
favorites_url(:id => user.id).ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question