scaffolding_extensions 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +6 -6
- data/lib/scaffolding_extensions/model/active_record.rb +31 -28
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 872960f23d1949998f8cc0ea351cd25fe6f86628
|
4
|
+
data.tar.gz: 56808d4a4119b089f7ae05b7750c58fe8a47a75a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5070abc1e3cda325816d9bfdd45c3b5597352d3e67e205cdc250b6f9e236aed8345b0f8dc5434db763e3ddeeda294caa21cd9570b087781eb3d20040aca69e56
|
7
|
+
data.tar.gz: 1bf61a5380e319e99660e127e797a8497c238397062e6e2500a3615f7ef43ad92cf65127965332a4a7cea0b3b36a9ee55fb29e216037bae16facc3e6b8cdd2f2
|
data/README
CHANGED
@@ -21,14 +21,14 @@ to better suit your needs.
|
|
21
21
|
Scaffolding Extensions currently supports:
|
22
22
|
|
23
23
|
* Web Frameworks
|
24
|
-
* Rails
|
25
|
-
* Ramaze
|
24
|
+
* Rails 4.0.0
|
25
|
+
* Ramaze 2012.12.08
|
26
26
|
* Camping 2.1
|
27
|
-
* Sinatra 1.3
|
28
|
-
* Rack 1.
|
27
|
+
* Sinatra 1.4.3
|
28
|
+
* Rack 1.5.2
|
29
29
|
* Object Relational Mappers
|
30
|
-
* ActiveRecord
|
31
|
-
* Sequel 3.
|
30
|
+
* ActiveRecord 4.0.0
|
31
|
+
* Sequel 3.48.0
|
32
32
|
* DataMapper 1.0.2 (see doc/datamapper.txt for details)
|
33
33
|
* Javascript Libaries (used for Ajax/Autocompleting, default is now JQuery)
|
34
34
|
* Prototype 1.6.0.3
|
@@ -96,8 +96,30 @@ module ScaffoldingExtensions::MetaActiveRecord
|
|
96
96
|
|
97
97
|
# Retrieve multiple objects given a hash of options
|
98
98
|
def scaffold_get_objects(options)
|
99
|
-
|
100
|
-
|
99
|
+
records = self
|
100
|
+
if options[:include]
|
101
|
+
records = records.includes(*options[:include])
|
102
|
+
records = records.references(*options[:include]) if scaffold_use_references
|
103
|
+
end
|
104
|
+
records = records.order(*options[:order]) if options[:order]
|
105
|
+
records = records.limit(options[:limit]) if options[:limit]
|
106
|
+
records = records.offset(options[:offset]) if options[:offset]
|
107
|
+
conditions = options[:conditions]
|
108
|
+
if conditions && Array === conditions && conditions.length > 0
|
109
|
+
if String === conditions[0]
|
110
|
+
records = records.where(*conditions)
|
111
|
+
else
|
112
|
+
conditions.each do |cond|
|
113
|
+
next if cond.nil?
|
114
|
+
records = case cond
|
115
|
+
when Hash, String then records.where(cond)
|
116
|
+
when Array then records.where(*cond)
|
117
|
+
when Proc then records.where(&cond)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
records.to_a
|
101
123
|
end
|
102
124
|
|
103
125
|
# Return the class, left foreign key, right foreign key, and join table for this habtm association
|
@@ -139,33 +161,14 @@ module ScaffoldingExtensions::MetaActiveRecord
|
|
139
161
|
table_name
|
140
162
|
end
|
141
163
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
nil
|
149
|
-
elsif Array === conditions[0]
|
150
|
-
conditions.each do |cond|
|
151
|
-
next unless cond
|
152
|
-
new_conditions[0] << cond.shift
|
153
|
-
cond.each{|c| new_conditions << c}
|
154
|
-
end
|
155
|
-
if new_conditions[0].length > 0
|
156
|
-
new_conditions[0] = "(#{new_conditions[0].join(") AND (")})"
|
157
|
-
new_conditions
|
158
|
-
else
|
159
|
-
nil
|
160
|
-
end
|
161
|
-
else
|
162
|
-
conditions
|
163
|
-
end
|
164
|
-
else
|
165
|
-
conditions
|
166
|
-
end
|
167
|
-
end
|
164
|
+
# Whether to use references in addition to includes for eager loading. This is
|
165
|
+
# necessary if you need to reference associated tables when filtering.
|
166
|
+
# Can be set with an instance variable.
|
167
|
+
def scaffold_use_references
|
168
|
+
@scaffold_use_references ||= false
|
169
|
+
end
|
168
170
|
|
171
|
+
private
|
169
172
|
# Updates associated records for a given reflection and from record to point to the
|
170
173
|
# to record
|
171
174
|
def scaffold_reflection_merge(reflection, from, to)
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffolding_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
5
|
-
prerelease:
|
4
|
+
version: 1.6.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeremy Evans
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-06-25 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description:
|
15
14
|
email: code@jeremyevans.net
|
@@ -75,6 +74,7 @@ files:
|
|
75
74
|
- scaffolds/search.rhtml
|
76
75
|
homepage: http://scaffolding-ext.rubyforge.org/
|
77
76
|
licenses: []
|
77
|
+
metadata: {}
|
78
78
|
post_install_message:
|
79
79
|
rdoc_options:
|
80
80
|
- --inline-source
|
@@ -97,21 +97,19 @@ rdoc_options:
|
|
97
97
|
require_paths:
|
98
98
|
- lib
|
99
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
100
|
requirements:
|
102
|
-
- -
|
101
|
+
- - '>='
|
103
102
|
- !ruby/object:Gem::Version
|
104
103
|
version: 1.8.6
|
105
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
105
|
requirements:
|
108
|
-
- -
|
106
|
+
- - '>='
|
109
107
|
- !ruby/object:Gem::Version
|
110
108
|
version: '0'
|
111
109
|
requirements: []
|
112
110
|
rubyforge_project: scaffolding-ext
|
113
|
-
rubygems_version:
|
111
|
+
rubygems_version: 2.0.2
|
114
112
|
signing_key:
|
115
|
-
specification_version:
|
113
|
+
specification_version: 4
|
116
114
|
summary: Administrative database front-end for multiple web-frameworks and ORMs
|
117
115
|
test_files: []
|