acts_as_status 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/acts_as_status.gemspec +5 -0
- data/lib/acts_as_status.rb +4 -3
- data/lib/acts_as_status/version.rb +1 -1
- data/readme.md +43 -0
- metadata +53 -5
- data/README +0 -0
data/acts_as_status.gemspec
CHANGED
@@ -21,4 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
# s.add_development_dependency "rspec"
|
23
23
|
# s.add_runtime_dependency "rest-client"
|
24
|
+
|
25
|
+
s.add_dependency('activerecord', '>= 3.0.0')
|
26
|
+
s.add_dependency('activemodel', '>= 3.0.0')
|
27
|
+
s.add_dependency('activesupport', '>= 3.0.0')
|
28
|
+
|
24
29
|
end
|
data/lib/acts_as_status.rb
CHANGED
@@ -15,9 +15,10 @@ module ActsAsStatus
|
|
15
15
|
where(["#{field} = ?", valid_value])
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
end
|
19
|
+
|
20
|
+
(class << self; self; end).send(:define_method, "available_#{field}") do
|
21
|
+
valid_values
|
21
22
|
end
|
22
23
|
|
23
24
|
end
|
data/readme.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
Acts As Status
|
2
|
+
=================
|
3
|
+
|
4
|
+
Installation
|
5
|
+
-----------
|
6
|
+
**In your Project's Gemfile**
|
7
|
+
> gem 'acts\_as\_status'
|
8
|
+
|
9
|
+
How to use it
|
10
|
+
---------
|
11
|
+
**Add it to your model**
|
12
|
+
|
13
|
+
> acts\_as\_status :status, %w[new waiting executing blocked finished]
|
14
|
+
|
15
|
+
Instance Methods
|
16
|
+
----------
|
17
|
+
**Status setter and getter**
|
18
|
+
|
19
|
+
> @foo.status = "new"
|
20
|
+
>
|
21
|
+
> @foo.status
|
22
|
+
>
|
23
|
+
> => "new"
|
24
|
+
|
25
|
+
|
26
|
+
Class Methods
|
27
|
+
----------
|
28
|
+
**Searching records by status**
|
29
|
+
|
30
|
+
It will give you a method for each status you set has valid
|
31
|
+
|
32
|
+
**Ex:**
|
33
|
+
|
34
|
+
> Foo.only_new
|
35
|
+
>
|
36
|
+
> => Return all foos which status == "new"
|
37
|
+
>
|
38
|
+
> Foo.only_waiting
|
39
|
+
>
|
40
|
+
> => Return all foos which status == "waiting"
|
41
|
+
|
42
|
+
|
43
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,56 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-05-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activerecord
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activemodel
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.0.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.0.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: activesupport
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.0.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
14
62
|
description: Make ActiveRecord Attributes to act as status
|
15
63
|
email:
|
16
64
|
- alepaezseq@gmail.com
|
@@ -20,12 +68,12 @@ extra_rdoc_files: []
|
|
20
68
|
files:
|
21
69
|
- .gitignore
|
22
70
|
- Gemfile
|
23
|
-
- README
|
24
71
|
- Rakefile
|
25
72
|
- acts_as_status.gemspec
|
26
73
|
- init.rb
|
27
74
|
- lib/acts_as_status.rb
|
28
75
|
- lib/acts_as_status/version.rb
|
76
|
+
- readme.md
|
29
77
|
homepage: https://github.com/iugu/acts_as_status
|
30
78
|
licenses: []
|
31
79
|
post_install_message:
|
@@ -46,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
94
|
version: '0'
|
47
95
|
requirements: []
|
48
96
|
rubyforge_project: acts_as_status
|
49
|
-
rubygems_version: 1.8.
|
97
|
+
rubygems_version: 1.8.23
|
50
98
|
signing_key:
|
51
99
|
specification_version: 3
|
52
100
|
summary: Make ActiveRecord Attributes to act as status
|
data/README
DELETED
File without changes
|