hammock 0.3.10.1 → 0.3.10.2
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/History.txt +4 -0
- data/hammock.gemspec +1 -1
- data/lib/hammock/scope.rb +9 -1
- data/lib/hammock.rb +1 -1
- metadata +1 -1
data/History.txt
CHANGED
data/hammock.gemspec
CHANGED
data/lib/hammock/scope.rb
CHANGED
@@ -46,12 +46,20 @@ module Hammock
|
|
46
46
|
dlog "#{requester_name} can#{"'t" unless result == :ok} create a #{record.class} with #{record.attributes.inspect}. #{describe_call_point 4}"
|
47
47
|
end
|
48
48
|
else
|
49
|
-
returning
|
49
|
+
returning record_in_scope?(route, record) ? :ok : :not_found do |result|
|
50
50
|
dlog "#{requester_name} can#{"'t" unless result == :ok} #{verb} #{record.class}<#{record.id}>. #{describe_call_point 4}"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
def record_in_scope? route, record
|
56
|
+
if (route_scope = scope_for_route(route)).nil?
|
57
|
+
# fail
|
58
|
+
else
|
59
|
+
record.send "#{route_scope}?", current_user
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
def current_verb_scope
|
56
64
|
if current_user && (scope_name = current_user_scope)
|
57
65
|
# dlog "current_user_scope is #{scope_name}."
|
data/lib/hammock.rb
CHANGED