review_and_approve 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -16,6 +16,11 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install review_and_approve
|
18
18
|
|
19
|
+
To install the database schema
|
20
|
+
|
21
|
+
$ rails g review_and_approve:install
|
22
|
+
$ bundle exec rake db:migrate
|
23
|
+
|
19
24
|
## Usage
|
20
25
|
|
21
26
|
### Setup
|
@@ -28,6 +33,10 @@ class Product < ActiveRecord::Base
|
|
28
33
|
end
|
29
34
|
```
|
30
35
|
|
36
|
+
To mark existing data as published:
|
37
|
+
|
38
|
+
$ bundle exec rake review_and_approve:create_caches
|
39
|
+
|
31
40
|
Use Cancan or other authorization mechanism to define a custom ability to 'publish' the records
|
32
41
|
Make sure your controller has access to current_ability method and it returns true or false on can? :publish, @product
|
33
42
|
|
@@ -47,7 +47,7 @@ module ReviewAndApprove
|
|
47
47
|
end
|
48
48
|
|
49
49
|
send(:define_method, :published_version) do |method_name|
|
50
|
-
CacheRecord.find_by_key(key_proc.call(self, method_name)).cache_data
|
50
|
+
CacheRecord.find_by_key(key_proc.call(self, method_name)).cache_data rescue nil
|
51
51
|
end
|
52
52
|
|
53
53
|
send(:define_method, :mass_assignment_authorizer) do |role = :default|
|
@@ -1,10 +1,16 @@
|
|
1
1
|
desc 'Create caches for existing data'
|
2
2
|
namespace :review_and_approve do
|
3
3
|
task :create_caches => :environment do
|
4
|
-
|
4
|
+
puts "In review_and_approve:create_caches"
|
5
|
+
ActiveRecord::Base.subclasses.select{|model|
|
6
|
+
model._using_rev_app? rescue false
|
7
|
+
}.each do |model|
|
8
|
+
|
9
|
+
puts "Processing #{model.name}"
|
5
10
|
model.find_each do |obj|
|
6
11
|
obj.review_and_approve_after_save_callback(true)
|
7
12
|
end
|
13
|
+
puts "\n"
|
8
14
|
end
|
9
15
|
end
|
10
16
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: review_and_approve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Paramveer Singh
|
@@ -14,6 +14,7 @@ date: 2013-05-20 00:00:00 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
+
prerelease: false
|
17
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
18
19
|
none: false
|
19
20
|
requirements:
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
- !ruby/object:Gem::Version
|
22
23
|
version: "2.0"
|
23
24
|
type: :development
|
24
|
-
prerelease: false
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rake
|
28
|
+
prerelease: false
|
28
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
29
30
|
none: false
|
30
31
|
requirements:
|
@@ -32,10 +33,10 @@ dependencies:
|
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: "0"
|
34
35
|
type: :development
|
35
|
-
prerelease: false
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: supermodel
|
39
|
+
prerelease: false
|
39
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
42
|
requirements:
|
@@ -43,10 +44,10 @@ dependencies:
|
|
43
44
|
- !ruby/object:Gem::Version
|
44
45
|
version: "0"
|
45
46
|
type: :development
|
46
|
-
prerelease: false
|
47
47
|
version_requirements: *id003
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: mocha
|
50
|
+
prerelease: false
|
50
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
51
52
|
none: false
|
52
53
|
requirements:
|
@@ -54,10 +55,10 @@ dependencies:
|
|
54
55
|
- !ruby/object:Gem::Version
|
55
56
|
version: "0"
|
56
57
|
type: :development
|
57
|
-
prerelease: false
|
58
58
|
version_requirements: *id004
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: debugger
|
61
|
+
prerelease: false
|
61
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
62
63
|
none: false
|
63
64
|
requirements:
|
@@ -65,10 +66,10 @@ dependencies:
|
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: "0"
|
67
68
|
type: :development
|
68
|
-
prerelease: false
|
69
69
|
version_requirements: *id005
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rails
|
72
|
+
prerelease: false
|
72
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
73
74
|
none: false
|
74
75
|
requirements:
|
@@ -76,10 +77,10 @@ dependencies:
|
|
76
77
|
- !ruby/object:Gem::Version
|
77
78
|
version: "0"
|
78
79
|
type: :runtime
|
79
|
-
prerelease: false
|
80
80
|
version_requirements: *id006
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: cancan
|
83
|
+
prerelease: false
|
83
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
84
85
|
none: false
|
85
86
|
requirements:
|
@@ -87,10 +88,10 @@ dependencies:
|
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: "0"
|
89
90
|
type: :runtime
|
90
|
-
prerelease: false
|
91
91
|
version_requirements: *id007
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: activerecord
|
94
|
+
prerelease: false
|
94
95
|
requirement: &id008 !ruby/object:Gem::Requirement
|
95
96
|
none: false
|
96
97
|
requirements:
|
@@ -98,7 +99,6 @@ dependencies:
|
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: "0"
|
100
101
|
type: :runtime
|
101
|
-
prerelease: false
|
102
102
|
version_requirements: *id008
|
103
103
|
description: Adds Review and Approval functionality for content sites.
|
104
104
|
email:
|
@@ -138,18 +138,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
138
|
requirements:
|
139
139
|
- - ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
hash: -927429969750751341
|
142
|
-
segments:
|
143
|
-
- 0
|
144
141
|
version: "0"
|
145
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
143
|
none: false
|
147
144
|
requirements:
|
148
145
|
- - ">="
|
149
146
|
- !ruby/object:Gem::Version
|
150
|
-
hash: -927429969750751341
|
151
|
-
segments:
|
152
|
-
- 0
|
153
147
|
version: "0"
|
154
148
|
requirements: []
|
155
149
|
|