0

I'm using draper and want to use one of the decorators in a view.

With HTML everything works, but decorators don't work in the Ajax version - I get an undefined method error.

In CommentDecorator:

delegate_all

def comment_author
  "#{user.firstname} #{user.lastname}"
end

In view:

comment.comment_author

I'm using exposure, so I don't need instance variables in views.

Zoran
  • 4,196
  • 2
  • 22
  • 33
willyW
  • 5
  • 4

1 Answers1

1

you can use comment.decorate.comment_author

Viktor Leonets
  • 473
  • 4
  • 13