Created
March 26, 2021 06:55
-
-
Save artificemm/fb162a744eefba1350c62c116f39ada1 to your computer and use it in GitHub Desktop.
Revisions
-
artificemm created this gist
Mar 26, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ module Navigable extend ActiveSupport::Concern def next self.class.where("id > ?", self.id).order(id: :asc).first end def previous self.class.where("id < ?", self.id).order(id: :desc).first end end