activerecord-mysql-index-hint 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b947256880defc67e564ff3b5710672ef010b8d8
4
- data.tar.gz: acd5aeea0b4cdc5aa6ef031a96831b678c5f7c7f
3
+ metadata.gz: b6ed09ffc9402615f78570a17a7c6b71dd16ef2c
4
+ data.tar.gz: beecd68ecbf4d2787669ffb0f1395309954a85e1
5
5
  SHA512:
6
- metadata.gz: e2375a761ac04b91400e5483b492612c242ce50a07e516def9dc5dc5101f941482ec662d890c3901e4d9fea9b1d8bfc274ba870328711945d46d8682af6729ad
7
- data.tar.gz: 1fb48165d7f17a309cc09090738b8d39bd3964f44d36bad6dd38917fee7b9ea510b812c644282c4bf6d2c758df93a17afe27066d04d12c66f32c18a7f75658a2
6
+ metadata.gz: 9e830a2a518533a98dfcd1792c4bed14d2745fdfe64766f6b7387d1fa7057a93790aa832b641e1b019b1783208248fbe6a8026987c10a043fbf09060ddb5f57c
7
+ data.tar.gz: b6ca8fcd39cc51ce292105933a5a8f071d3628e4b3309bd74d22b20b5d102b509fa6d181a73dcec8e01346810c64688beb3418068f18b8dfc24cc9214718c05c
@@ -1,3 +1,6 @@
1
1
  # ChangeLog
2
+ ## 0.0.2
3
+ - Don't directly touch AR::Base, but do it via AS.on_load (Thanks @amatsuda)
4
+
2
5
  ## 0.0.1
3
6
  - First release
data/README.md CHANGED
@@ -8,12 +8,16 @@ MySQL index hint support for ActiveRecord
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
11
- gem 'activerecord-mysql-index-hint'
11
+ ```ruby
12
+ gem 'activerecord-mysql-index-hint'
13
+ ```
12
14
 
13
15
  ## Usage
14
16
 
15
- class Product < ActiveRecord::Base
16
- end
17
+ ```ruby
18
+ class Product < ActiveRecord::Base
19
+ end
17
20
 
18
- Product.where(user_id: 1).force_index(:idx_user_id).first
19
- # => SELECT `products`.* FROM `products` FORCE INDEX(`idx_user_id`) WHERE `products`.`user_id` = 1 LIMIT 1
21
+ Product.where(user_id: 1).force_index(:idx_user_id).first
22
+ # => SELECT `products`.* FROM `products` FORCE INDEX(`idx_user_id`) WHERE `products`.`user_id` = 1 LIMIT 1
23
+ ```
@@ -1,5 +1,4 @@
1
1
  require 'active_record'
2
- require 'active_record/relation/query_methods'
3
2
 
4
3
  module ActiveRecordMysqlIndexHint
5
4
  def use_index(*args)
@@ -22,5 +21,8 @@ module ActiveRecordMysqlIndexHint
22
21
  end
23
22
  end
24
23
 
25
- ActiveRecord::Base.send :extend, ActiveRecordMysqlIndexHint
26
- ActiveRecord::Relation.send :include, ActiveRecordMysqlIndexHint
24
+ ActiveSupport.on_load :active_record do
25
+ require 'active_record/relation/query_methods'
26
+ ActiveRecord::Base.extend ActiveRecordMysqlIndexHint
27
+ ActiveRecord::Relation.send :include, ActiveRecordMysqlIndexHint
28
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordMysqlIndexHint
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-mysql-index-hint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Issei Naruta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-28 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: appraisal
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mysql2
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: MySQL index hint support for ActiveRecord
@@ -101,9 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rspec
106
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
107
  - Appraisals
108
108
  - ChangeLog.md
109
109
  - Gemfile
@@ -127,17 +127,17 @@ require_paths:
127
127
  - lib
128
128
  required_ruby_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.0.3
140
+ rubygems_version: 2.2.2
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: MySQL index hint support for ActiveRecord