hash_extension 0.0.2 → 0.0.3
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/lib/hash_extension.rb +6 -1
- data/lib/hash_extension/version.rb +1 -1
- data/website/index.html +5 -5
- data/website/index.txt +2 -2
- metadata +2 -2
data/History.txt
CHANGED
data/lib/hash_extension.rb
CHANGED
@@ -18,7 +18,12 @@ module ActiveRecord
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def find_as_hashes(*args)
|
21
|
-
options =
|
21
|
+
options = (
|
22
|
+
args.respond_to?(extract_options!) ?
|
23
|
+
args.extract_options! :
|
24
|
+
extract_options_from_args!(args) # pre 2.0 compatibility
|
25
|
+
)
|
26
|
+
|
22
27
|
if options.include?(:include)
|
23
28
|
raise ActiveRecord::StatementInvalid, "find_as_hashes cannot accept :include options!"
|
24
29
|
end
|
data/website/index.html
CHANGED
@@ -31,9 +31,9 @@
|
|
31
31
|
<div id="main">
|
32
32
|
|
33
33
|
<h1>hash_extension</h1>
|
34
|
-
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/
|
34
|
+
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/enterpriserails"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/
|
36
|
+
<a href="http://rubyforge.org/projects/enterpriserails" class="numbers">0.0.3</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
@@ -71,7 +71,7 @@
|
|
71
71
|
<p>you can say:</p>
|
72
72
|
|
73
73
|
|
74
|
-
<p><pre class='syntax'><span class="ident">hash</span><span class="punct"
|
74
|
+
<p><pre class='syntax'><span class="ident">hash</span><span class="punct">.</span><span class="ident">foo</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">bar</span><span class="punct">'</span></pre></p>
|
75
75
|
|
76
76
|
|
77
77
|
<p>Two variants of basic ActiveRecord query types are supported—find and find_by_sql, inventively recast as find_as_hashes and find_by_sql_as_hashes. E.g.,</p>
|
@@ -106,7 +106,7 @@
|
|
106
106
|
<p>You can replace it with this:</p>
|
107
107
|
|
108
108
|
|
109
|
-
<p><pre class='syntax'><span class="constant">MyObject</span><span class="punct">.</span><span class="ident">find_as_hashes</span><span class="punct">(
|
109
|
+
<p><pre class='syntax'><span class="constant">MyObject</span><span class="punct">.</span><span class="ident">find_as_hashes</span><span class="punct">(</span><span class="symbol">:all</span><span class="punct">)</span></pre></p>
|
110
110
|
|
111
111
|
|
112
112
|
<p>The same data is returned, but without the overhead of creating large, complex ActiveRecord objects. The rest of your code will continue to behave as expected, because the object-like access will now work correctly with the hashes returned by these methods.</p>
|
@@ -132,7 +132,7 @@
|
|
132
132
|
|
133
133
|
<p>Comments are welcome. Send an email to <a href="mailto:dan@chak.org">Dan Chak</a>.</p>
|
134
134
|
<p class="coda">
|
135
|
-
<a href="FIXME email">
|
135
|
+
<a href="FIXME email">Dan Chak</a>, 10th February 2008<br>
|
136
136
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
137
137
|
</p>
|
138
138
|
</div>
|
data/website/index.txt
CHANGED
@@ -24,7 +24,7 @@ Instead of:
|
|
24
24
|
|
25
25
|
you can say:
|
26
26
|
|
27
|
-
<pre syntax="ruby">hash
|
27
|
+
<pre syntax="ruby">hash.foo = 'bar'</pre>
|
28
28
|
|
29
29
|
Two variants of basic ActiveRecord query types are supported -- find and find_by_sql, inventively recast as find_as_hashes and find_by_sql_as_hashes. E.g.,
|
30
30
|
|
@@ -50,7 +50,7 @@ Anywhere you have syntax like this:
|
|
50
50
|
|
51
51
|
You can replace it with this:
|
52
52
|
|
53
|
-
<pre syntax="ruby">MyObject.find_as_hashes(
|
53
|
+
<pre syntax="ruby">MyObject.find_as_hashes(:all)</pre>
|
54
54
|
|
55
55
|
The same data is returned, but without the overhead of creating large, complex ActiveRecord objects. The rest of your code will continue to behave as expected, because the object-like access will now work correctly with the hashes returned by these methods.
|
56
56
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Chak
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-03-21 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|