public activity - Rails: Public_Activity Gem - uninitialised constant -
i trying make app rails 4.
i have installed public_activity gem.
i followed ryan bates railscast , took controller based approach, , lighter common option (as opposed tracking model).
in activities_controller have:
class activitiescontroller < applicationcontroller def index @activities = publicactivity::activity.order("created_at desc") end end
in project.rb, have:
include publicactivity::common
in projects controller, create action, have:
@project.create_activity :create, owner: current_user
in activity view - index, have:
<% activities.each |activity| %> <div class="col-md-4"> <div class="indexdisplay"> <span class="indexheading"> <%= link_to activity.owner.name, activity.owner if activity.owner %> </span> <span class="indexsubtext"> <%= render_activity activity %> </span>
in public activity (view folder)/project/_create.html.erb, have:
<% if activity.trackable %> <%= link_to activity.trackable.name, activity.trackable %> <% else %> has since been removed <% end %>
when try this, error:
nameerror @ /activities uninitialized constant actionview::compiledtemplates::activities
i tried replacing opening line of activity#index activities, activity, changed error message to:
nameerror @ /activities uninitialized constant actionview::compiledtemplates::activities
what error mean? how fix it?
thank you
it seems use class in loop. try use instance variable in controller.
change this
<% activities.each |activity| %>
into
<% @activities.each |activity| %>
Comments
Post a Comment