{"id":19575057,"url":"https://github.com/chief/acts_as_previous_next","last_synced_at":"2025-04-27T06:30:51.318Z","repository":{"id":2164212,"uuid":"3110157","full_name":"chief/acts_as_previous_next","owner":"chief","description":"A gem allowing an active_record model to have previous, next based on single column","archived":false,"fork":false,"pushed_at":"2014-01-31T08:41:06.000Z","size":237,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T13:24:10.508Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chief.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-05T13:11:17.000Z","updated_at":"2015-03-03T02:15:56.000Z","dependencies_parsed_at":"2022-07-27T16:18:53.713Z","dependency_job_id":null,"html_url":"https://github.com/chief/acts_as_previous_next","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chief%2Facts_as_previous_next","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chief%2Facts_as_previous_next/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chief%2Facts_as_previous_next/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chief%2Facts_as_previous_next/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chief","download_url":"https://codeload.github.com/chief/acts_as_previous_next/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224062762,"owners_count":17249289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T06:45:35.599Z","updated_at":"2024-11-11T06:45:37.337Z","avatar_url":"https://github.com/chief.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActsAsPreviousNext\n\n[![Build Status](https://travis-ci.org/chief/acts_as_previous_next.png?branch=master)](https://travis-ci.org/chief/acts_as_previous_next)\n[![Code Climate](https://codeclimate.com/github/chief/acts_as_previous_next.png)](https://codeclimate.com/github/chief/acts_as_previous_next)\n[![Gem Version](https://badge.fury.io/rb/acts_as_previous_next.png)](http://badge.fury.io/rb/acts_as_previous_next)\n[![Dependency Status](https://gemnasium.com/chief/acts_as_previous_next.png)](https://gemnasium.com/chief/acts_as_previous_next)\n\n## Description\n\nThis `acts_as` extension provides the capability for having previous \u0026 next methods\nfor an object. Previous \u0026 next are based on a specified column (default is id).\n\n## Install\n\n* Rails \u003e= 3\n\n  In your Gemfile\n\n    `gem 'acts_as_previous_next'`\n\n  Currently is tested on ruby 1.9.3 \u0026 2.0.0 and mysql\n\n## Example\n\n```ruby\n  class Post \u003c ActiveRecord::Base\n    acts_as_previous_next\n    # acts_as_previous_next column: :id\n    # or\n    # acts_as_previous_next :id\n  end\n\n  post = Post.new\n  post.next # =\u003e nil\n  post.save\n  post.next # =\u003e post\n  post.previous # =\u003e post\n  another_post = Post.new\n  another_post.save\n  another_post.next # =\u003e post\n  another_post.previous # =\u003e post\n```\n\n## Authorization support\n\nCurrently [CanCan](https://github.com/ryanb/cancan) authorization is supported\nas option (`false` by default). If cancan authorization is enabled then `current_ability`\nmust be passed to `previous` `next` methods. So the previous example with cancan:\n\n```ruby\n  class Post \u003c ActiveRecord::Base\n    acts_as_previous_next with_cancan: true\n\n    belongs_to :user\n  end\n```\n\nAnd in your view:\n\n```ruby\n  link_to 'Next', @post.next(current_ability)\n  link_to 'Previous', @post.previous(current_ability)\n```\n\n## License\n\nacts_as_previous_next is released under the [MIT License](http://opensource.org/licenses/MIT)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchief%2Facts_as_previous_next","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchief%2Facts_as_previous_next","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchief%2Facts_as_previous_next/lists"}