Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Rails Model Translation

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 107
    Comment on it

    Rails Model Translation
    Translation in Rails active records is used to provide integration between object and the Rails internationalization (i18n) framework. Rails does this using ActiveModel::Translation.Example:

    class Blog
      extend ActiveModel::Translation
    end
    


    By using human_attribute_name, attribute names can be transformed into more human format. The human format is usually defined into your locale file as:

    #File: config/locales/app.pt-BR.yml
    
    pt-BR:
      activemodel:
        attributes:
          blog:
            title: 'Rails'
    

    You can access this as:

    Blog.human_attribute_name('title') # => "Rails"
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: