Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created October 6, 2011 23:12
Show Gist options
  • Save typeoneerror/1268967 to your computer and use it in GitHub Desktop.
Save typeoneerror/1268967 to your computer and use it in GitHub Desktop.
# Returns recent activity for the authenticated user
def activity
cache_key = "activity_#{@api_user[:id]}"
@activity = Rails.cache.fetch(cache_key) do
Record.activity.any_of({:to => @api_user[:id]}, {:from => @api_user[:id]}).entries
end
render :json => @activity
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment