benhoskings-hammock 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/hammock.gemspec +2 -2
- data/lib/hammock.rb +1 -1
- data/lib/hammock/monkey_patches/active_record.rb +1 -1
- data/lib/hammock/overrides.rb +4 -0
- data/lib/hammock/restful_actions.rb +3 -1
- data/lib/hammock/restful_support.rb +1 -1
- data/lib/hammock/route_for.rb +1 -1
- data/lib/hammock/route_node.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.2.10 2009-03-17
|
2
|
+
Added AR::Base.suggest_scope for narrowing the scope in the suggest action.
|
3
|
+
Changed identifier in AR::Base#concise_inspect from #id to #to_param.
|
4
|
+
Fixed raise condition for entities arg to RouteNode#for, and improved exception message.
|
5
|
+
Changed squash! to compact! in route_for, to only remove nil elements (and not, say, models with no records that respond true to bla
|
6
|
+
|
7
|
+
|
1
8
|
== 0.2.9 2009-03-13
|
2
9
|
Updated partial_exists? to default format to the current request format instead of html, and accept format instead of extension as a parameter.
|
3
10
|
|
data/hammock.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{hammock}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.10"
|
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"]
|
9
|
-
s.date = %q{2009-03-
|
9
|
+
s.date = %q{2009-03-17}
|
10
10
|
s.description = %q{Hammock is a Rails plugin that eliminates redundant code in a very RESTful manner. It does this in lots in lots of different places, but in one manner: it encourages specification in place of implementation. Hammock enforces RESTful resource access by abstracting actions away from the controller in favour of a clean, model-like callback system. Hammock tackles the hard and soft sides of security at once with a scoping security system on your models. Specify who can verb what resources under what conditions once, and everything else - the actual security, link generation, index filtering - just happens. Hammock inspects your routes and resources to generate a routing tree for each resource. Parent resources in a nested route are handled transparently at every point - record retrieval, creation, and linking. It makes more sense when you see how it works though, so check out the screencast!}
|
11
11
|
s.email = ["ben@hoskings.net"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc", "misc/scaffold.txt"]
|
data/lib/hammock.rb
CHANGED
@@ -8,7 +8,7 @@ Dir.glob("#{File.dirname __FILE__}/hammock/**/*.rb").each {|dep|
|
|
8
8
|
} if defined?(RAILS_ROOT) # Loading Hammock components under 'rake package' fails.
|
9
9
|
|
10
10
|
module Hammock
|
11
|
-
VERSION = '0.2.
|
11
|
+
VERSION = '0.2.10'
|
12
12
|
|
13
13
|
def self.included base # :nodoc:
|
14
14
|
Hammock.constants.map {|constant_name|
|
data/lib/hammock/overrides.rb
CHANGED
@@ -118,7 +118,9 @@ module Hammock
|
|
118
118
|
fields = params[:fields].split(',')
|
119
119
|
@queries = params[:q].downcase.split(/\s+/)
|
120
120
|
|
121
|
-
mdl.
|
121
|
+
mdl.send :with_scope, :find => suggest_scope.to_hash do
|
122
|
+
mdl.suggest fields, @queries
|
123
|
+
end
|
122
124
|
end
|
123
125
|
|
124
126
|
if @results.nil?
|
@@ -141,7 +141,7 @@ module Hammock
|
|
141
141
|
|
142
142
|
# TODO process /^creating_\w+_id$/ as well
|
143
143
|
def set_creator_id_if_appropriate
|
144
|
-
if @record.respond_to?
|
144
|
+
if @record.respond_to? :creator_id=
|
145
145
|
if current_user.nil?
|
146
146
|
log "Warning: @#{@record.base_model}.creator_id isn't being set, since current_user was nil."
|
147
147
|
else
|
data/lib/hammock/route_for.rb
CHANGED
data/lib/hammock/route_node.rb
CHANGED
@@ -42,7 +42,7 @@ module Hammock
|
|
42
42
|
|
43
43
|
def for verb, entities, options
|
44
44
|
raise "Hammock::RouteNode#for requires an explicitly specified verb as its first argument." unless verb.is_a?(Symbol)
|
45
|
-
raise "
|
45
|
+
raise "Hammock::RouteNode#for requires an Array of at least one record or resource." if entities.empty? || !entities.is_a?(Array)
|
46
46
|
|
47
47
|
entity = entities.shift
|
48
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benhoskings-hammock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Hoskings
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|