mongoid-publishable 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -9
- data/lib/{mongoid_publishable.rb → mongoid-publishable.rb} +0 -0
- data/lib/mongoid/publishable/version.rb +1 -1
- data/spec/mongoid/publishable/callback_collection_spec.rb +0 -1
- data/spec/mongoid/publishable/callback_spec.rb +0 -1
- data/spec/mongoid/publishable/callbacks_spec.rb +0 -1
- data/spec/mongoid/publishable/queue_spec.rb +0 -1
- data/spec/mongoid/publishable/queuing_spec.rb +0 -1
- data/spec/mongoid/publishable/unpublished_object_spec.rb +0 -1
- data/spec/mongoid/publishable_spec.rb +0 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/models/callbackable_object.rb +0 -2
- data/spec/support/models/publishable_object.rb +0 -2
- data/spec/support/models/queuing_controller.rb +0 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Ever wanted to allow your users to create something (or somethings) before authe
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem "mongoid-publishable"
|
15
|
+
gem "mongoid-publishable"
|
16
16
|
```
|
17
17
|
|
18
18
|
And then execute:
|
@@ -53,8 +53,6 @@ end
|
|
53
53
|
In your controllers, or anywhere you save the objects, you can swap out your `save` calls for `persist_and_publish!` calls, this method accepts an optional user. If none is passed, or the object that you do pass is nil, it'll raise an exception, so you can handle your authentication there:
|
54
54
|
|
55
55
|
```ruby
|
56
|
-
require: "mongoid/publishable"
|
57
|
-
|
58
56
|
class ReviewsController < ApplicationController
|
59
57
|
include Mongoid::Publishable::Queuing
|
60
58
|
|
@@ -82,8 +80,6 @@ end
|
|
82
80
|
An alternative without the exception handling would be:
|
83
81
|
|
84
82
|
```ruby
|
85
|
-
require: "mongoid/publishable"
|
86
|
-
|
87
83
|
class ReviewsController < ApplicationController
|
88
84
|
include Mongoid::Publishable::Queuing
|
89
85
|
|
@@ -112,8 +108,6 @@ end
|
|
112
108
|
The advantage to the former style (using exceptions) is that you can handle them globally in your ApplicationController using this code:
|
113
109
|
|
114
110
|
```ruby
|
115
|
-
require: "mongoid/publishable"
|
116
|
-
|
117
111
|
class ApplicationController < ActionController::Base
|
118
112
|
include Mongoid::Publishable::Queuing
|
119
113
|
|
@@ -132,8 +126,6 @@ end
|
|
132
126
|
The publishing queue is stored in the user's session. After authentication, you'll want to call `publish_via` on the queue, which will then publish all the objects it contains. Here's an example:
|
133
127
|
|
134
128
|
```ruby
|
135
|
-
require: "mongoid/publishable"
|
136
|
-
|
137
129
|
class UserSessionsController < ApplicationController
|
138
130
|
include Mongoid::Publishable::Queuing
|
139
131
|
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-publishable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- Procfile
|
124
124
|
- README.md
|
125
125
|
- Rakefile
|
126
|
+
- lib/mongoid-publishable.rb
|
126
127
|
- lib/mongoid/.DS_Store
|
127
128
|
- lib/mongoid/publishable.rb
|
128
129
|
- lib/mongoid/publishable/callback.rb
|
@@ -133,7 +134,6 @@ files:
|
|
133
134
|
- lib/mongoid/publishable/unpublished_error.rb
|
134
135
|
- lib/mongoid/publishable/unpublished_object.rb
|
135
136
|
- lib/mongoid/publishable/version.rb
|
136
|
-
- lib/mongoid_publishable.rb
|
137
137
|
- mongoid_publishable.gemspec
|
138
138
|
- spec/.DS_Store
|
139
139
|
- spec/mongoid/publishable/callback_collection_spec.rb
|
@@ -167,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
segments:
|
169
169
|
- 0
|
170
|
-
hash:
|
170
|
+
hash: 4491913414913790925
|
171
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
172
|
none: false
|
173
173
|
requirements:
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
segments:
|
178
178
|
- 0
|
179
|
-
hash:
|
179
|
+
hash: 4491913414913790925
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project:
|
182
182
|
rubygems_version: 1.8.24
|