Skip to content

Commit

Permalink
Version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickreimer committed Nov 28, 2015
1 parent 2ec3094 commit 29b0feb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.0.0 (November 28, 2015)
-------------------------

* Make this gem thread-safe for PostgreSQL
(samphilipd, [#16](https://github.com/djreimer/sequenced/pull/16))

2.0.0 (October 24, 2014)
------------------------

Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
[![Code Climate](https://codeclimate.com/github/djreimer/sequenced.png)](https://codeclimate.com/github/djreimer/sequenced)
[![Gem Version](https://badge.fury.io/rb/sequenced.png)](http://badge.fury.io/rb/sequenced)

Sequenced is a simple gem that generates scoped sequential IDs for
ActiveRecord models. This gem provides an `acts_as_sequenced` macro that
automatically assigns a unique, sequential ID to each record. The sequential ID is
not a replacement for the database primary key, but rather adds another way to
Sequenced is a simple gem that generates scoped sequential IDs for
ActiveRecord models. This gem provides an `acts_as_sequenced` macro that
automatically assigns a unique, sequential ID to each record. The sequential ID is
not a replacement for the database primary key, but rather adds another way to
retrieve the object without exposing the primary key.

## Purpose

It's generally a bad practice to expose your primary keys to the world
in your URLs. However, it is often appropriate to number objects in sequence
It's generally a bad practice to expose your primary keys to the world
in your URLs. However, it is often appropriate to number objects in sequence
(in the context of a parent object).

For example, given a Question model that has many Answers, it makes sense
to number answers sequentially for each individual question. You can achieve
to number answers sequentially for each individual question. You can achieve
this with Sequenced in one line of code:

```ruby
Expand All @@ -34,7 +34,7 @@ end
## Installation

Add the gem to your Gemfile:

gem 'sequenced'

Install the gem with bundler:
Expand Down Expand Up @@ -98,8 +98,8 @@ end

### Overriding the default sequential ID column

By default, Sequenced uses the `sequential_id` column and assumes it already
exists. If you wish to store the sequential ID in different integer column,
By default, Sequenced uses the `sequential_id` column and assumes it already
exists. If you wish to store the sequential ID in different integer column,
simply specify the column name with the `column` option:

```ruby
Expand All @@ -108,7 +108,7 @@ acts_as_sequenced scope: :question_id, column: :my_sequential_id

### Starting the sequence at a specific number

By default, Sequenced begins sequences with 1. To start at a different
By default, Sequenced begins sequences with 1. To start at a different
integer, simply set the `start_at` option:

```ruby
Expand Down Expand Up @@ -137,7 +137,7 @@ acts_as_sequenced skip: lambda { |r| r.score == 0 }

## Example

Suppose you have a question model that has many answers. This example
Suppose you have a question model that has many answers. This example
demonstrates how to use Sequenced to enable access to the nested answer
resource via its sequential ID.

Expand All @@ -151,7 +151,7 @@ end
class Answer < ActiveRecord::Base
belongs_to :question
acts_as_sequenced scope: :question_id

# Automatically use the sequential ID in URLs
def to_param
self.sequential_id
Expand Down
2 changes: 1 addition & 1 deletion lib/sequenced/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Sequenced
VERSION = "2.0.0"
VERSION = "3.0.0"
end

0 comments on commit 29b0feb

Please sign in to comment.