search for: next_pitur

Displaying 1 result from an estimated 1 matches for "next_pitur".

Did you mean: next_piture
2011 Apr 07
0
Refactor sorting of images
...(sort_order).eql?(prev_picture.send(sort_order)) pictures = self.class.where(:state => ''published'').order("#{sort_order.to_s} DESC").all (pictures.index(self) == 0) ? nil : pictures[pictures.index(self)-1] else prev_picture end end Ok, the next_piture method looks very similar. Basically this will fetch the previous picture from the database. If the sort_order attribute from both are the same, it will fetch all pictures and grabs the one in the array before the current one. I tried the whole thing with a second order parameter, but it really ge...