#25 new
Lucas de Castro

Fix AR attribute translations

Reported by Lucas de Castro | May 1st, 2009 @ 03:16 AM

ActiveRecord#human_attribute_name aren't working fine.

Open a rails console and run the following code:

require 'test/unit'

include Test::Unit::Assertions

class Person < ActiveRecord::Base; end

I18n.backend.store_translations :pt,
  :activerecord => {
    :models => {
      :person => 'Pessoa',
      :attributes => {
        :person => {:name => 'Nome'}

assert_equal 'Person', Person.human_name
assert_equal 'Name', Person.human_attribute_name('name')

I18n.locale = :pt

assert_equal 'Pessoa', Person.human_name
assert_equal 'Nome', I18n.t('activerecord.models.attributes.person.name')
assert_equal 'Nome', Person.human_attribute_name('name') # fail

Comments and changes to this ticket

  • Ronald de Gunst

    Ronald de Gunst May 8th, 2009 @ 09:33 PM

    Invalid ticket

    :attributes is no attribute of :models, :attributes is a attribute of :activerecord

    With the right translations definition all is ok.

    I18n.backend.store_translations :pt, :activerecord => {

    :models => {:person => 'Pessoa'},
    :attributes => {:person => {:name => 'Nome'}}


  • Lucas de Castro

    Lucas de Castro May 8th, 2009 @ 10:02 PM

    Ronald de Gunst, you're right.

    I am sorry.

  • david001

    david001 August 9th, 2019 @ 03:32 PM

    thanks its works i almost Visit lots of websites to find the best Solution.

  • WaduRsik

    WaduRsik March 9th, 2020 @ 03:53 PM

    Now, the reform of the use is differently followed by the team. Skills of the turns and 123 help me invited for the struggle. Improvement of joy is flicked for all humans. The intensity is done for humans. Petal is formal for the mid of the means. The source is ensured for the mid of the paths for humans.

  • david

    david May 14th, 2020 @ 09:47 AM

    I have gone through this article named 'Fix AR attribute translations'. Until reading this article, I don't know what is the AR attribute and its function. Now I can describe everything about it. Thank you so much for sharing this article. Cell Phone Booster for House

  • peyila

    peyila May 14th, 2020 @ 11:06 PM

    it's really nice and meanful. it's really cool blog. Linking is very useful thing.you have really helped lots of people who visit blog and provide them usefull information. Benefits of Rutabagas

  • peyila

    peyila May 14th, 2020 @ 11:10 PM

    Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have. Essential Oils for Wrinkles

  • peyila

    peyila May 14th, 2020 @ 11:13 PM

    You ought to basically fantastic not to mention solid advice, which means notice: Foods That Helps Boost Your Mood

  • peyila

    peyila May 14th, 2020 @ 11:17 PM

    Cool you inscribe, the info is really salubrious further fascinating, I'll give you a connect to my scene. Benefits Of Pomegranates

  • peyila

    peyila May 14th, 2020 @ 11:22 PM

    There you can download for free, see the first of these data. Benefits of Orach

  • peyila

    peyila May 14th, 2020 @ 11:25 PM

    On this page you can read my interests, write something special. Benefits of Lemongrass Essential Oil

  • peyila

    peyila May 14th, 2020 @ 11:29 PM

    For this web site, you will see our account, remember to go through this info. Benefits of Garlic

  • pbawerawi

    pbawerawi May 15th, 2020 @ 10:21 AM

    Det er mange joggere på markedet som aldri har eksperimentert med air force 1 sko https://www.jonaskotilbud.com/ Floatride-minneoppskum.

  • pbawerawi

    pbawerawi May 18th, 2020 @ 03:21 PM

    Itse voisin Jordan 4 Retro kengät https://www.klaudokengat.com/ mennä pois käyttämällä pyöräilyä 100 kk: n urheilukenkäpukuihin pukeutuneena melko kapeisiin sukkaihin, tosin tunteessani lopulta osittain tyyppiäsi, tunsin todella, että nämä tassut ovat yhtyneitä ns. varvaslaatikkosi.

  • pbawerawi

    pbawerawi May 19th, 2020 @ 02:28 PM

    Type geassocieerd is eigenlijk hoe de kosten eigenlijk nuttig zijn voor individuen die misschien niet of helemaal niet willen wijden aan het verkrijgen van een pad-schoen. Voor alleen Asics Mexico 66 GDX schoenen https://www.cusokasports.com/ van één Benjamin ontvang je hier best veel.

  • pbawerawi

    pbawerawi May 21st, 2020 @ 04:26 AM

    Ügyeljen arra, hogy vásároljon egy utazási Nike Zoom Winflo 6 cipő https://www.slezokacipo.com/ zseblámpát, amikor indul, ha nem földrajzi földrajzi helyzetben van (senki nem részesíti előnyben a kicsapodott bokáját), valamint néhány adatkompressziós lábbelit, amellyel elindulhat, valamint platformlapokat, amelyek megakadályozzák a valódi melegítést.

  • peyila

    peyila June 24th, 2020 @ 09:43 AM

    At this point you'll find out what is important, it all gives a url to the appealing page: david hoffmeister apple podcast

  • peyila

    peyila June 24th, 2020 @ 09:53 AM

    There you can download for free, see the first of these data. acim

  • peyila

    peyila June 24th, 2020 @ 10:03 AM

    I came onto your blog while focusing just slightly submits. Nice strategy for next, I will be bookmarking at once seize your complete rises... david hoffmeister podcast

  • mursalin

    mursalin June 27th, 2020 @ 06:03 PM

    very interesting, good job and thanks for sharing such a good blog. buying real estate in Hungary

  • Charles Hoover

    Charles Hoover November 7th, 2020 @ 03:55 PM

    For one thing, we need to clarify that neither the mercury mastercard login nor Visa organization gives any of the cards made in their names. All things being equal, these cards are techniques for installment, with the banks in numerous nations giving the Mastercards that utilization said installment strategies.

  • lookpong

    lookpong January 16th, 2021 @ 08:07 AM

    เกมสล็อตแตกบ่อย จ่ายจริง แจกรัวๆ เกมสล็อตออนไลน์ได้รับการการันตีแล้ว ว่านักเดิมพันสามารถเล่นเกมได้ตลอดและสามารถรวยได้เพียงชั่วข้ามคืน เท่านั้น ณ เวลานี้คงต้องยกให้เกมสล็อตออนไลน์เป็นเกมที่ทำเงินและสามารถสร้างรายได้ ได้ตลอด 24 ชั่วโมง ด้วยเหตุนี้ จึงมีหลายเว็บไซต์เริ่มที่จะทำการเปิดเว็บไซต์และเกมออนไลน์ต่างๆ เพิ่มมากขึ้น จึงทำให้เป็นที่นิยมในหมู่นักเสี่ยงโชคเลยก็ว่าได้ แต่เพราะเหตุนี้จึงทำให้เว็บไซต์ที่มีอยู่บนโลกมีจำนวนที่เยอะ ทำให้ลูกค้าหน้าใหม่ๆที่จะทำการทดลองเล่น ไม่รู้ว่าจะเข้าเล่นเว็บไซต์ไหนดี เราจึงได้หยิบเว็บไซต์มาแนะนำ เป็นเว็บไซต์ที่แอดมินยืนยันเลยว่า ดีที่สุด ณ ขณะนี้เลยก็ว่าได้ คลิกลองเล่น https://www.xosuperslot.com

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff

People watching this ticket