Skip to content

Instantly share code, notes, and snippets.

@vrinek
Created July 30, 2009 07:26
Show Gist options
  • Save vrinek/158605 to your computer and use it in GitHub Desktop.
Save vrinek/158605 to your computer and use it in GitHub Desktop.
# used for paginations (Model.paginate :page => page_from_params)
# it just makes the WillPaginate::InvalidPage errors go away
def page_from_params
(p = params[:page].to_i) > 0 ? p : 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment