RailsCasts Pro episodes are now free!

Learn more or hide this

mondev's Profile

GitHub User: mondev

Comments by

Avatar

you were right. found and fixed. thx!

Avatar

By the way, there's a small typo in the user_presenter.rb file:

delegate :username, to: :user

should be

delegate :username, :to => :user
Avatar

Great tutorial, as always! Quick question however. How can we use this technique for local objects inside partials?

We have a partial with a local variable called user (not @user). when trying to apply the same logic to it, i get back the following error 500:

ruby
ActionView::Template::Error (undefined method `to_presenter' for #<User:0x10b80f0a0>):
    1: - present user do |user_presenter|
    2:   #contact_information
    3:     %dl
    4:       %dt Name