I am having a problem when I deploy my project to Heroku. Running it in my localhost works fine and I but deployed gives me this error:
I am using the public_activity gem to get a feed of the last activity done in my app.
2020-06-22T18:00:31.055655+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] ActionView::Template::Error (undefined method `with_indifferent_access' for "{}":String):
2020-06-22T18:00:31.055655+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] 1: <% @activities.each do |activity| %>
2020-06-22T18:00:31.055656+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] 2: <div class="activity">
2020-06-22T18:00:31.055656+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] 3: <%= activity.owner.name if activity.owner %>
2020-06-22T18:00:31.055656+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] 4: <%= render_activity activity %>
2020-06-22T18:00:31.055657+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] 5: </div>
2020-06-22T18:00:31.055657+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] 6: <% end %>
2020-06-22T18:00:31.055658+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b]
2020-06-22T18:00:31.055658+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] app/views/activities/index.html.erb:4
2020-06-22T18:00:31.055658+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] app/views/activities/index.html.erb:1
2020-06-22T18:00:31.055671+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] app/controllers/concerns/users/time_zone.rb:19:in `block in set_time_zone'
2020-06-22T18:00:31.055671+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] app/controllers/concerns/users/time_zone.rb:19:in `set_time_zone'
2020-06-22T18:00:31.055672+00:00 app[web.1]: [3e23fc99-a452-4cb4-900d-087df67a3f6b] lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
2020-06-22T18:00:31.056486+00:00 app[web.1]: I, [2020-06-22T18:00:31.056422 #4] INFO -- : [3e23fc99-a452-4cb4-900d-087df67a3f6b] Processing by ErrorsController#internal_server_error as HTML
2020-06-22T18:00:31.057546+00:00 app[web.1]: I, [2020-06-22T18:00:31.057488 #4] INFO -- : [3e23fc99-a452-4cb4-900d-087df67a3f6b] Rendering errors/internal_server_error.html.erb within layouts/errors
2020-06-22T18:00:31.057825+00:00 app[web.1]: I, [2020-06-22T18:00:31.057762 #4] INFO -- : [3e23fc99-a452-4cb4-900d-087df67a3f6b] Rendered errors/internal_server_error.html.erb within layouts/errors (Duration: 0.2ms | Allocations: 42)
2020-06-22T18:00:31.058712+00:00 app[web.1]: I, [2020-06-22T18:00:31.058652 #4] INFO -- : [3e23fc99-a452-4cb4-900d-087df67a3f6b] Rendered shared/_favicons.html.erb (Duration: 0.0ms | Allocations: 6)
2020-06-22T18:00:31.058933+00:00 app[web.1]: I, [2020-06-22T18:00:31.058882 #4] INFO -- : [3e23fc99-a452-4cb4-900d-087df67a3f6b] Completed 500 Internal Server Error in 2ms (Views: 1.6ms | ActiveRecord: 0.0ms | Allocations: 810)
The controller for activities I am using is this one:
class ActivitiesController < ApplicationController
def index
@activities = PublicActivity::Activity.order("created_at desc").where(recipient_id: current_account.id, recipient_type: "Account")
end
end
Then I have these lines in the post and discussion controller after create, update, and destroy save:
@post.create_activity :create, owner: current_user, recipient: current_account
The code in app/views/index.html.erb
<% @activities.each do |activity| %>
<div class="activity">
<%= activity.owner.name if activity.owner %>
<%= render_activity activity %>
</div>
<% end %>
and app/controllers/concerns/users/time_zone.rb
module Users
module TimeZone
extend ActiveSupport::Concern
included do
helper_method :browser_time_zone
around_action :set_time_zone
end
def browser_time_zone
browser_tz = ActiveSupport::TimeZone.find_tzinfo(cookies[:browser_time_zone])
ActiveSupport::TimeZone.all.find { |zone| zone.tzinfo == browser_tz } || Time.zone
rescue TZInfo::UnknownTimezone, TZInfo::InvalidTimezoneIdentifier
Time.zone
end
def set_time_zone
if user_signed_in? && current_user.time_zone?
Time.use_zone(current_user.time_zone) { yield }
else
yield
end
end
end
end
The code from the render activity, public_activity gem gets it from the folder views/public_activity/post/_create.html.erb looks like this:
added a comm
<% if activity.trackable %>
<%= link_to activity.trackable.title, activity.trackable %>
<% else %>
which has since been removed
<% end %>
app/views/activities/index.html.erbandapp/controllers/concerns/users/time_zone.rbtoo.render_activityhelper please.