Skip to content

Commit

Permalink
Only show the preloaded messages for activities that makes sense
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanPorta committed Nov 9, 2014
1 parent 4063b09 commit 3e424e4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/views/activities/index.json.jbuilder
@@ -1,6 +1,12 @@
json.array!(@activities) do |activity|
activity = activity.decorate
json.extract! activity, :id, :type, :activity_message, :reciprocate_message, :acknowledge_message
json.extract! activity, :id, :type, :activity_message

if activity.type == 'received'
json.reciprocate_message = activity.reciprocate_message
json.acknowledge_message = activity.acknowledge_message
end

json.message do
# Sadly, this step is needed because extract doesn't find the at_in_words methods from the decorator.
json.extract! activity.message, :id, :verb, :sender, :recipient, :acknowledged_at, :acknowledged_at_in_words, :created_at, :created_at_in_words
Expand Down

0 comments on commit 3e424e4

Please sign in to comment.