Skip to content

Instantly share code, notes, and snippets.

@DefV
Created September 22, 2008 15:22
Show Gist options
  • Save DefV/12016 to your computer and use it in GitHub Desktop.
Save DefV/12016 to your computer and use it in GitHub Desktop.
u = User.find(params[:id])
u.activities.last # Does a find(:last)
# Add something to the activities
u.activities.create!({:description => "List activities"})
u.activities.last # Fetches all activities of the user - Painfull when a user has 30000 activities
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment