ruby - getting an undefined method error from "_user.html.erb" in Rails 3 -
if getting error
undefined method impressionist_count' nil:nilclass
after trying use line inside _user.html.erb
<%= @user.impressionist_count+@user.microposts.sum(&:impressionist_count) %>
where need defined? have inside user.rb
def impressionist_count impressions.size end
i tried in various helpers no avail
when "render @users" each user accessible partial local variable "user". partial should like:
<%= user.impressionist_count+user.microposts.sum(&:impressionist_count) %>
Comments
Post a Comment