consul 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -2
- data/lib/consul/active_record.rb +0 -1
- data/lib/consul/version.rb +1 -1
- data/spec/consul/active_record_spec.rb +4 -4
- metadata +3 -3
data/README.md
CHANGED
|
@@ -212,7 +212,7 @@ Here is a power implementation that can provide a list of assignable values for
|
|
|
212
212
|
Here you can see how to activate the authorization layer and use the new validations:
|
|
213
213
|
|
|
214
214
|
story = Story.new
|
|
215
|
-
|
|
215
|
+
Power.current = Power.new(:role => :guest) # activate the authorization layer
|
|
216
216
|
|
|
217
217
|
story.assignable_states # ['delivered'] # apparently we're not admins
|
|
218
218
|
|
|
@@ -239,7 +239,6 @@ You can not only authorize scalar attributes like strings or integers that way,
|
|
|
239
239
|
|
|
240
240
|
The `authorize_values_for` macro comes with many useful options and details best explained in the [assignable_values README](https://github.com/makandra/assignable_values), so head over there for more. The macro is basically a shortcut for this:
|
|
241
241
|
|
|
242
|
-
attr_accessor :power
|
|
243
242
|
assignable_values_for :field, :through => lambda { Power.current }
|
|
244
243
|
|
|
245
244
|
|
data/lib/consul/active_record.rb
CHANGED
data/lib/consul/version.rb
CHANGED
|
@@ -12,13 +12,13 @@ describe Consul::ActiveRecord do
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
it 'should generate a getter and setter for a @power field' do
|
|
15
|
+
it 'should not generate a getter and setter for a @power field (change from previous versions)' do
|
|
16
16
|
klass = Note.disposable_copy do
|
|
17
17
|
authorize_values_for :attribute
|
|
18
18
|
end
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
note = klass.new
|
|
20
|
+
note.should_not respond_to(:power)
|
|
21
|
+
note.should_not respond_to(:power=)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it 'should obtain assignable values from Power.current' do
|
metadata
CHANGED