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 CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.3.10.2 2009-07-20
2
+ Refactored scope_for_route checks in can_verb_record? out into record_in_scope?, adding nil scope check.
3
+
4
+
1
5
  == 0.3.10.1 2009-07-20
2
6
  Convert verb to_sym in RouteNode#default_verb_for and #safe_for?.
3
7
 
data/hammock.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hammock}
5
- s.version = "0.3.10.1"
5
+ s.version = "0.3.10.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Hoskings"]
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 record.send("#{scope_for_route(route)}?", current_user) ? :ok : :not_found do |result|
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
@@ -4,7 +4,7 @@ require 'ambition'
4
4
  require 'ambition/adapters/active_record'
5
5
 
6
6
  module Hammock
7
- VERSION = '0.3.10.1'
7
+ VERSION = '0.3.10.2'
8
8
  IncludeTarget = ActionController::Base
9
9
 
10
10
  def self.included base # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10.1
4
+ version: 0.3.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hoskings