activerecord 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activerecord might be problematic. Click here for more details.

@@ -1,7 +1,9 @@
1
- TIMES = (ENV['N'] || 10000).to_i
2
-
3
- require 'rubygems'
1
+ require File.expand_path('../../../load_paths', __FILE__)
4
2
  require "active_record"
3
+ require 'benchmark/ips'
4
+
5
+ TIME = (ENV['BENCHMARK_TIME'] || 20).to_i
6
+ RECORDS = (ENV['BENCHMARK_RECORDS'] || TIME*1000).to_i
5
7
 
6
8
  conn = { :adapter => 'sqlite3', :database => ':memory:' }
7
9
 
@@ -57,8 +59,8 @@ end
57
59
  notes = ActiveRecord::Faker::LOREM.join ' '
58
60
  today = Date.today
59
61
 
60
- puts 'Inserting 10,000 users and exhibits...'
61
- 10_000.times do
62
+ puts "Inserting #{RECORDS} users and exhibits..."
63
+ RECORDS.times do
62
64
  user = User.create(
63
65
  :created_at => today,
64
66
  :name => ActiveRecord::Faker.name,
@@ -73,9 +75,7 @@ puts 'Inserting 10,000 users and exhibits...'
73
75
  )
74
76
  end
75
77
 
76
- require 'benchmark'
77
-
78
- Benchmark.bm(46) do |x|
78
+ Benchmark.ips(TIME) do |x|
79
79
  ar_obj = Exhibit.find(1)
80
80
  attrs = { :name => 'sam' }
81
81
  attrs_first = { :name => 'sam' }
@@ -86,73 +86,68 @@ Benchmark.bm(46) do |x|
86
86
  :created_at => Date.today
87
87
  }
88
88
 
89
- x.report("Model#id (x#{(TIMES * 100).ceil})") do
90
- (TIMES * 100).ceil.times { ar_obj.id }
89
+ x.report("Model#id") do
90
+ ar_obj.id
91
91
  end
92
92
 
93
93
  x.report 'Model.new (instantiation)' do
94
- TIMES.times { Exhibit.new }
94
+ Exhibit.new
95
95
  end
96
96
 
97
97
  x.report 'Model.new (setting attributes)' do
98
- TIMES.times { Exhibit.new(attrs) }
98
+ Exhibit.new(attrs)
99
99
  end
100
100
 
101
101
  x.report 'Model.first' do
102
- TIMES.times { Exhibit.first.look }
102
+ Exhibit.first.look
103
103
  end
104
104
 
105
- x.report("Model.all limit(100) (x#{(TIMES / 10).ceil})") do
106
- (TIMES / 10).ceil.times { Exhibit.look Exhibit.limit(100) }
105
+ x.report("Model.all limit(100)") do
106
+ Exhibit.look Exhibit.limit(100)
107
107
  end
108
108
 
109
- x.report "Model.all limit(100) with relationship (x#{(TIMES / 10).ceil})" do
110
- (TIMES / 10).ceil.times { Exhibit.feel Exhibit.limit(100).includes(:user) }
109
+ x.report "Model.all limit(100) with relationship" do
110
+ Exhibit.feel Exhibit.limit(100).includes(:user)
111
111
  end
112
112
 
113
- x.report "Model.all limit(10,000) x(#{(TIMES / 1000).ceil})" do
114
- (TIMES / 1000).ceil.times { Exhibit.look Exhibit.limit(10000) }
113
+ x.report "Model.all limit(10,000)" do
114
+ Exhibit.look Exhibit.limit(10000)
115
115
  end
116
116
 
117
117
  x.report 'Model.create' do
118
- TIMES.times { Exhibit.create(exhibit) }
118
+ Exhibit.create(exhibit)
119
119
  end
120
120
 
121
121
  x.report 'Resource#attributes=' do
122
- TIMES.times {
123
- exhibit = Exhibit.new(attrs_first)
124
- exhibit.attributes = attrs_second
125
- }
122
+ e = Exhibit.new(attrs_first)
123
+ e.attributes = attrs_second
126
124
  end
127
125
 
128
126
  x.report 'Resource#update' do
129
- TIMES.times { Exhibit.first.update_attributes(:name => 'bob') }
127
+ Exhibit.first.update_attributes(:name => 'bob')
130
128
  end
131
129
 
132
130
  x.report 'Resource#destroy' do
133
- TIMES.times { Exhibit.first.destroy }
131
+ Exhibit.first.destroy
134
132
  end
135
133
 
136
134
  x.report 'Model.transaction' do
137
- TIMES.times { Exhibit.transaction { Exhibit.new } }
135
+ Exhibit.transaction { Exhibit.new }
138
136
  end
139
137
 
140
138
  x.report 'Model.find(id)' do
141
- id = Exhibit.first.id
142
- TIMES.times { Exhibit.find(id) }
139
+ User.find(1)
143
140
  end
144
141
 
145
142
  x.report 'Model.find_by_sql' do
146
- TIMES.times {
147
- Exhibit.find_by_sql("SELECT * FROM exhibits WHERE id = #{(rand * 1000 + 1).to_i}").first
148
- }
143
+ Exhibit.find_by_sql("SELECT * FROM exhibits WHERE id = #{(rand * 1000 + 1).to_i}").first
149
144
  end
150
145
 
151
- x.report "Model.log x(#{TIMES * 10})" do
152
- (TIMES * 10).times { Exhibit.connection.send(:log, "hello", "world") {} }
146
+ x.report "Model.log" do
147
+ Exhibit.connection.send(:log, "hello", "world") {}
153
148
  end
154
149
 
155
- x.report "AR.execute(query) (#{TIMES / 2})" do
156
- (TIMES / 2).times { ActiveRecord::Base.connection.execute("Select * from exhibits where id = #{(rand * 1000 + 1).to_i}") }
150
+ x.report "AR.execute(query)" do
151
+ ActiveRecord::Base.connection.execute("Select * from exhibits where id = #{(rand * 1000 + 1).to_i}")
157
152
  end
158
153
  end
@@ -117,9 +117,7 @@ module ActiveRecord
117
117
  conditions = klass.send(:instance_eval, &conditions)
118
118
  end
119
119
 
120
- if conditions
121
- klass.send(:sanitize_sql, conditions)
122
- end
120
+ conditions
123
121
  end
124
122
  end
125
123
  end
@@ -1065,7 +1065,11 @@ Calling dynamic finder with less number of arguments than the number of attribut
1065
1065
  eowarn
1066
1066
  end
1067
1067
  if match.finder?
1068
- options = arguments.extract_options!
1068
+ options = if arguments.length > attribute_names.size
1069
+ arguments.extract_options!
1070
+ else
1071
+ {}
1072
+ end
1069
1073
  relation = options.any? ? scoped(options) : scoped
1070
1074
  relation.send :find_by_attributes, match, attribute_names, *arguments
1071
1075
  elsif match.instantiator?
@@ -5,7 +5,7 @@ require 'set'
5
5
  require 'active_record/connection_adapters/statement_pool'
6
6
  require 'arel/visitors/bind_visitor'
7
7
 
8
- gem 'mysql', '~> 2.8.1'
8
+ gem 'mysql', '~> 2.8'
9
9
  require 'mysql'
10
10
 
11
11
  class Mysql
@@ -2,7 +2,7 @@ module ActiveRecord
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 8
5
+ TINY = 9
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.8
5
- prerelease:
4
+ version: 3.1.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Heinemeier Hansson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-09 00:00:00.000000000 Z
11
+ date: 2012-12-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
21
- version: 3.1.8
19
+ version: 3.1.9
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
- version: 3.1.8
26
+ version: 3.1.9
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activemodel
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
37
- version: 3.1.8
33
+ version: 3.1.9
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
45
- version: 3.1.8
40
+ version: 3.1.9
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: arel
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: 2.2.3
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: 2.2.3
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: tzinfo
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: 0.3.29
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: 0.3.29
78
69
  description: Databases on Rails. Build a persistent domain model by mapping database
@@ -215,31 +206,27 @@ files:
215
206
  - lib/rails/generators/active_record.rb
216
207
  homepage: http://www.rubyonrails.org
217
208
  licenses: []
209
+ metadata: {}
218
210
  post_install_message:
219
211
  rdoc_options:
220
- - --main
212
+ - "--main"
221
213
  - README.rdoc
222
214
  require_paths:
223
215
  - lib
224
216
  required_ruby_version: !ruby/object:Gem::Requirement
225
- none: false
226
217
  requirements:
227
- - - ! '>='
218
+ - - ">="
228
219
  - !ruby/object:Gem::Version
229
220
  version: 1.8.7
230
221
  required_rubygems_version: !ruby/object:Gem::Requirement
231
- none: false
232
222
  requirements:
233
- - - ! '>='
223
+ - - ">="
234
224
  - !ruby/object:Gem::Version
235
225
  version: '0'
236
- segments:
237
- - 0
238
- hash: 2577013611060670621
239
226
  requirements: []
240
227
  rubyforge_project:
241
- rubygems_version: 1.8.24
228
+ rubygems_version: 2.0.0.preview2.1
242
229
  signing_key:
243
- specification_version: 3
230
+ specification_version: 4
244
231
  summary: Object-relational mapper framework (part of Rails).
245
232
  test_files: []