Forum: Rails I18n ActiveRecord accepts_nested_attributes_for problem

Bb007ea9916e45856033ffe97f8843ac?d=identicon&s=25 Salvatore Pelligra (iazel)
on 2013-01-05 21:25
I'm in this case:
class Man < ActiveRecord::Base
  has_many :eyes
  accepts_nested_attributes_for :eyes
end
class Eye < ActiveRecord::Base
  belongs_to :man
  validates_inclusion_of :color, in: { %w[brown green blue] }
end

Views (in HAML):
= form_for @man do |f|
  - if @man.errors.any?
    #error_explanation
      %h2= t 'errors.messages.record_invalid', count: @man.errors.count
      %ul
        - @man.errors.full_messages.each do |msg|
          %li= msg

  = f.fields_for(:eyes) do |b|
    .field
      = b.label :color
      = b.text_field :color

  .actions
    = f.submit 'Send'


it.yml:
it:
  activerecord:
    attributes:
      customer/eyes:
        color: Colore
    errors:
      models:
        man/eyes:
          color:
            inclusion: non valido

However the label of color is not translated (but it is with
'actviterecord.attributes.eye.color'), the attribute in the error
message is "Eyes" and the rest is not translated...
I'm using Rails 3.2.6 and digging in the active_model/translations.rb it
seems to manage the model/sub_model syntax.
Someone can give me and hand? Thanks.
9129aedbfc6e10f6f1562522798d72a0?d=identicon&s=25 "Bruno da Silva João" <brunodasj@gmail.com> (Guest)
on 2013-01-15 11:50
(Received via mailing list)
massa... parece ser simples de utilizar...


On 5 January 2013 18:25, Salvatore Pelligra <lists@ruby-forum.com>
wrote:

> Views (in HAML):
>       = b.label :color
>       customer/eyes:
> I'm using Rails 3.6 and digging in the active_model/translations.rb it
> To unsubscribe from this group, send email to
> rails-i18n+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rails-i18n?hl=en.
>
>


--
Bruno da Silva Joo
Telecommunication Technician
Network Administrator
Gmail & Gtalk: brunodasj@gmail.com
MSN: brunohamp@hotmail.com
 Fone: +55 (48) 96585472 (TIM)
B08130c062fb41479f7e1c3b33e75a7c?d=identicon&s=25 top 3. (top_3)
on 2013-08-09 06:22
منتديات توب عرب للمبدعين احساس منتديات عامة
افضل المنتديات العربية
http://www.top3rab.mrsaal.com
http://www.top3rab.mrsaal.com/forums/toparab10
http://www.top3rab.mrsaal.com/forums/toparab14
http://www.top3rab.mrsaal.com/forums/toparab41
http://www.top3rab.mrsaal.com/forums/toparab47
http://www.top3rab.mrsaal.com/forums/toparab54
http://www.top3rab.mrsaal.com/forums/toparab49
http://www.top3rab.mrsaal.com/forums/toparab49
http://www.top3rab.mrsaal.com/forums/toparab48
http://www.top3rab.mrsaal.com/forums/toparab48
http://www.top3rab.mrsaal.com/forums/toparab50
http://www.top3rab.mrsaal.com/forums/toparab51
http://www.top3rab.mrsaal.com/forums/toparab52
http://www.top3rab.mrsaal.com/forums/toparab53
http://www.top3rab.mrsaal.com/forums/toparab53
http://www.top3rab.mrsaal.com/forums/toparab55
http://www.top3rab.mrsaal.com/forums/toparab56
http://www.top3rab.mrsaal.com/forums/toparab57
http://www.top3rab.mrsaal.com/forums/toparab57
http://www.top3rab.mrsaal.com/forums/toparab58
http://www.top3rab.mrsaal.com/forums/toparab59
http://www.top3rab.mrsaal.com/forums/toparab60
http://www.top3rab.mrsaal.com/forums/toparab61
http://www.top3rab.mrsaal.com/forums/toparab62
http://www.top3rab.mrsaal.com/forums/toparab62
http://www.top3rab.mrsaal.com/forums/toparab64
http://www.top3rab.mrsaal.com/forums/toparab65
http://www.top3rab.mrsaal.com/forums/toparab66
http://www.top3rab.mrsaal.com/forums/toparab67
http://www.top3rab.mrsaal.com/forums/toparab67
http://www.top3rab.mrsaal.com/forums/toparab68
http://www.top3rab.mrsaal.com/forums/toparab69
http://www.top3rab.mrsaal.com/forums/toparab69
http://www.top3rab.mrsaal.com/forums/toparab70/
http://www.top3rab.mrsaal.com/forums/toparab71
http://www.top3rab.mrsaal.com/forums/toparab72
http://www.top3rab.mrsaal.com/forums/toparab72
http://www.top3rab.mrsaal.com/forums/toparab73
http://www.top3rab.mrsaal.com/forums/toparab74
http://www.top3rab.mrsaal.com/forums/toparab75
http://www.top3rab.mrsaal.com/forums/toparab75
http://www.top3rab.mrsaal.com/forums/toparab75
http://www.top3rab.mrsaal.com/forums/toparab76
http://www.top3rab.mrsaal.com/forums/toparab76
http://www.top3rab.mrsaal.com/forums/toparab77
http://www.top3rab.mrsaal.com/forums/toparab78
http://www.top3rab.mrsaal.com/forums/toparab79
http://www.top3rab.mrsaal.com/forums/toparab79
http://www.top3rab.mrsaal.com/forums/toparab80
http://www.top3rab.mrsaal.com/forums/toparab80
http://www.top3rab.mrsaal.com/forums/toparab81
http://www.top3rab.mrsaal.com/forums/toparab81
http://www.top3rab.mrsaal.com/forums/toparab81
http://www.top3rab.mrsaal.com/forums/toparab82
http://www.top3rab.mrsaal.com/forums/toparab82
http://www.top3rab.mrsaal.com/forums/toparab82
http://www.top3rab.mrsaal.com/forums/toparab42
http://www.top3rab.mrsaal.com/forums/toparab43
http://www.top3rab.mrsaal.com/forums/toparab43
http://www.top3rab.mrsaal.com/forums/toparab45
http://www.top3rab.mrsaal.com/forums/toparab46
http://www.top3rab.mrsaal.com/forums/toparab44
http://www.top3rab.mrsaal.com/forums/toparab44
This topic is locked and can not be replied to.