@comments = []
@preComments = Comment.where(:resource_hash => resource_hash).
sort(:created_at.desc).all
@preComments.each do |comment|
newComment = comment
u = ::User.find_by_id comment.user_id
newComment.display_name = "Some name"
if u.image_location.nil?
newComment.image_location = "defaultpic"
else
newComment.image_location = u.image_location
end
p u
@comments << newComment
p "HERE!!!!!"
end
Это мой код, но я получаю сообщение об ошибке
undefined method `display_name=' for #
Так как мне назначить display_name
?