status-manager 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,38 @@
1
1
  status-manager
2
2
  ==============
3
3
 
4
- ActiveRecord Model status manager
4
+ ## Description
5
+ Simple ActiveRecord Model Status Manager
6
+
7
+ ## Usage
8
+
9
+ ### Rails 3.x
10
+
11
+ ```ruby
12
+ gem 'status-manager'
13
+ ```
14
+
15
+ ### Example
16
+
17
+ ```ruby
18
+ class Product < ActiveRecord::Base
19
+ attr_accessible :title, :status
20
+
21
+ # acts_as_status :status_attribute in model, {:status_value => 'status_value that is saved in database'}
22
+ acts_as_status :status, :onsale => 'onsale', :reject => 'reject', :pending => 'pending', :soldout => 'soldout'
23
+ status_group :close, [:reject, :pending]
24
+
25
+ end
26
+ ```
27
+
28
+ ```ruby
29
+ # select
30
+ @onsale_products = Product.status_onsale
31
+ @closed_products = Product.status_close
32
+
33
+ assert @onsale_products.first.status_onsale?
34
+ assert @closed_products.first.status_close?
35
+
36
+ # update
37
+ @closed_products.first.status_to(:onsale) ## => update just attribute value
38
+ @closed_products.first.update_status_onsale ## => update with database
@@ -1,3 +1,3 @@
1
1
  module StatusManager
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.2'
3
3
  end
Binary file
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'status-manager'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
4
4
  s.date = '2013-07-15'
5
5
  s.summary = "ActiveRecord Model Status Manager"
6
6
  s.description = "ActiveRecord Model Status Manager"
Binary file
@@ -5,6 +5,7 @@ class StatusManagerTest < Test::Unit::TestCase
5
5
 
6
6
  def test_current_status
7
7
  product = Product.first
8
+ puts product.status
8
9
  assert_equal true, product.status_onsale?
9
10
  end
10
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: status-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -25,6 +25,8 @@ files:
25
25
  bGliL3N0YXR1cy1tYW5hZ2VyLnJi
26
26
  - !binary |-
27
27
  bGliL3N0YXR1cy1tYW5hZ2VyL3ZlcnNpb24ucmI=
28
+ - !binary |-
29
+ c3RhdHVzLW1hbmFnZXItMC4xLjEuZ2Vt
28
30
  - !binary |-
29
31
  c3RhdHVzLW1hbmFnZXIuZ2Vtc3BlYw==
30
32
  - !binary |-