Sha256: 287337f106ea0ca62db9879f873149ad84716fc0b8c5120f3897202a76f29ddc

Contents?: true

Size: 960 Bytes

Versions: 1

Compression:

Stored size: 960 Bytes

Contents

# Pubdraft

Quickly add published/drafted states to your ActiveRecord models, with helpful scopes and instance methods for querying and changing the states

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'pubdraft'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install pubdraft

## Usage

```ruby
# requires string column `state` to exist
# $ rails g migration AddStateToMyModels state

class MyModel < ActiveRecord::Base
  pubdraft
end

record = MyModel.create!
record.published? #=> true

record.draft!
record.drafted?   #=> true

record.publish!
record.published? #=> true

MyModel.published #=> [published records]
MyModel.drafted   #=> [drafted records]
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pubdraft-0.0.1 README.md