Skip to content

Instantly share code, notes, and snippets.

@lucasdavila
Created September 19, 2012 21:46
Show Gist options
  • Select an option

  • Save lucasdavila/3752508 to your computer and use it in GitHub Desktop.

Select an option

Save lucasdavila/3752508 to your computer and use it in GitHub Desktop.
Rails I18n for nested attributes
'pt-BR':
activerecord:
attributes:
student:
name: 'Nome'
student_users: 'Usuários'
# ...
student/student_users:
student_id: 'Código aluno'
user_id: 'Código usuário'
# ...
errors:
messages:
taken: "já foi usado"
# ...
# Obs:
# o modelo student has_many student_users
# ao usar 'validates_uniqueness_of :user_id' no modelo student_user, a mensagem de erro será "Código usuário já foi usado"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment