Created
March 23, 2012 21:16
-
-
Save rafapolo/2175131 to your computer and use it in GitHub Desktop.
modelos do activerecord atuam como adjacentes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def previous | |
Arquivo.where('arquivos.ordem < ?', self.ordem).order('ordem ASC').last | |
end | |
def next | |
Arquivo.where('arquivos.ordem > ?', self.ordem).order('ordem ASC').first | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment