Skip to content

Instantly share code, notes, and snippets.

@matthieuprat
Created March 9, 2016 10:25
Show Gist options
  • Save matthieuprat/419b9c4167e6e8cb3b03 to your computer and use it in GitHub Desktop.
Save matthieuprat/419b9c4167e6e8cb3b03 to your computer and use it in GitHub Desktop.
Enhance Kaminari support of negative paddings
module Kaminari
module PageScopeMethods
def padding(num)
@_padding = num
new_offset_value = offset_value + num.to_i
if new_offset_value < 0
limit([limit_value + new_offset_value, 0].max).offset(0)
else
offset(new_offset_value)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment