hash_extension 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 0.0.3 2008-02-08
2
+ * 1 major enhancement:
3
+ * find_as_hashes method now works in Rails 2.x, backwards compatible for Rails 1.x
4
+
1
5
  == 0.0.2 2008-02-08
2
6
  * 1 major enhancement:
3
7
  * Addition of ActiveRecord extensions that return hashes
@@ -18,7 +18,12 @@ module ActiveRecord
18
18
  end
19
19
 
20
20
  def find_as_hashes(*args)
21
- options = extract_options_from_args!(args)
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
@@ -2,7 +2,7 @@ module HashExtension #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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/hash_extension"; return false'>
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/hash_extension" class="numbers">0.0.2</a>
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">['</span><span class="string">foo</span><span class="punct">']</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">bar</span><span class="punct">'</span></pre></p>
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&#8212;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">(&quot;</span><span class="string">select * from my_objects</span><span class="punct">&quot;)</span></pre></p>
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">FIXME full name</a>, 9th February 2008<br>
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>
@@ -24,7 +24,7 @@ Instead of:
24
24
 
25
25
  you can say:
26
26
 
27
- <pre syntax="ruby">hash['foo'] = 'bar'</pre>
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("select * from my_objects")</pre>
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.2
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-02-09 00:00:00 -05:00
12
+ date: 2008-03-21 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15