css - Apply conditional class in a rails view inside map{} using haml -
i trying apply class conditionally names associated reminder. if there 3 persons associated reminder - jay, jonah , jamison... , jonah 1 acknowledged reminder, want name have class "acknowledge", though want display 3 names.
%tbody -reminder.each |r| %tr %td =r.persons.each.map{|n| n.name{:class=> ("acknowledge" if r.completed_by.id == n.id)} }.join(',')
i tried apply class inside map{} shown above error saying
syntax error, unexpected =>, expecting '}'
any appreciated.
%tbody - reminder.each |r| %tr %td - r.persons.each |person| %span{class: "acknowledge" if person.completed_by.id == n.id}= person.name
Comments
Post a Comment