when destroying one element from my database, the index view
<% for activity in @activities %>
<%= activity.text %> by <%= current_user.name %> on <%= Time.current%> <br/>
<% end %>
no longer find the <%=trackable.element_name%> from config/pba.yml
activity:
element:
create: ' <%=trackable.element_name%> has been created '
update: ' <%=trackable.element_name%> has been edited '
destroy: ' <%=trackable.element_name%> has been removed '
and display something like:
element1 has been edited by me on 2012-08-19 16:20:44 UTC
Template not defined by me on 2012-08-19 16:20:44 UTC
“template not defined” being the element i have just deleted….
i would like to store the element name and the action that has been taken though…!?
I released a new version of the
public_activitygem which allows you to create views for every activity you display, so you can simply check iftrackableis still in the database and act accordingly.Upgrade your gem to https://github.com/pokonski/public_activity#upgrading-to-04 and check out my example application which does exactly that:
https://github.com/pokonski/activity_blog/blob/master/app/views/public_activity/post/_update.slim#L4
where link_to_trackable is just a helper checking if trackable exists: https://github.com/pokonski/activity_blog/blob/master/app/helpers/application_helper.rb#L34