Skip to content

Instantly share code, notes, and snippets.

@almonk
Created August 24, 2012 15:42
Show Gist options
  • Save almonk/3452124 to your computer and use it in GitHub Desktop.
Save almonk/3452124 to your computer and use it in GitHub Desktop.
def next
project.images.first(:conditions => ["position > ?", position], :order => "position asc")
end
def prev
project.images.last(:conditions => ["position < ?", position], :order => "position desc")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment