Sha256: f5a1797e63928d81365cc071116e808e6d818f8f25ca2285881dbf6c051ad3e2

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

module ActiveSupport
  module Inflector
    # Replaces special characters in a string so that it may be used as part of a 'pretty' URL.
    #
    # ==== Examples
    #
    # class Person
    #   def to_param
    #     "#{id}-#{name.parameterize}"
    #   end
    # end
    #
    # @person = Person.find(1)
    # # => #<Person id: 1, name: "Дональд Кнут">
    #
    # <%= link_to(@person.name, person_path %>
    # # => <a href="/person/1-donald-knut">Дональд Кнут</a>
    def parameterize_with_russian(string, sep = '-')
      parameterize_without_russian(Russian::transliterate(string), sep)
    end
    alias_method :parameterize_without_russian, :parameterize
    alias_method :parameterize, :parameterize_with_russian
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
yaroslav-russian-0.0.8 lib/russian/active_support_ext/parameterize.rb
russian-0.0.8 lib/russian/active_support_ext/parameterize.rb