activerecord-simple_index_name 0.1.0.beta1 → 0.1.0

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: 849ff84b3033d6444d18452d1d9ddd961a063628
4
- data.tar.gz: 29de6a7c397a663a8d261370f6775227e81b96b5
3
+ metadata.gz: 7fa6b9aae3727e763a002f35d1ce57aad24114fa
4
+ data.tar.gz: eb91da3010ce3ae2e2ca0054706da0c16d9917d8
5
5
  SHA512:
6
- metadata.gz: 6530739de8506345c4224df48afa26f3c6829547e9e676df8767bc299f4d3117311c8a2cfa2efdc89ae9ec0f8d88d2c89b41c47622f3924357eb9863120186b2
7
- data.tar.gz: a39c6530502f4a65ba71ee8412d7097b3f8fb8104aad23b8a931c7f66912a879c61254a02e4e65099e543994d94722d9ac9f8a977a4cdd0e29d2ea5d27f6508d
6
+ metadata.gz: 1a8931aae60ddc11a440ab53c811a4d57a779c893af7902475190a0234b2fa658a8b5a3defac05e19e128509ee1368ff5287fee49ce1f19c0186b39b633bb936
7
+ data.tar.gz: ec67d7146748d7243b38c26b128cfd82a00ce24fe4ebcb59d494f92bbd1908edc6809fcd133c74b6499b2ad912f420a2b5ad585c5bba57e0d6cd6912cb039054
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## Unreleased
2
+ [full changelog](http://github.com/sue445/rubicure/compare/v0.1.0...master)
3
+
4
+ ## v0.1.0
5
+ * First release
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # Activerecord::SimpleIndexName
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/activerecord/simple_index_name`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Shorten index name
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/activerecord-simple_index_name.svg)](https://badge.fury.io/rb/activerecord-simple_index_name)
5
6
  [![Build Status](https://travis-ci.org/sue445/activerecord-simple_index_name.svg?branch=master)](https://travis-ci.org/sue445/activerecord-simple_index_name)
6
7
  [![Dependency Status](https://gemnasium.com/sue445/activerecord-simple_index_name.svg)](https://gemnasium.com/sue445/activerecord-simple_index_name)
7
8
  [![Coverage Status](https://coveralls.io/repos/sue445/activerecord-simple_index_name/badge.svg?branch=master&service=github)](https://coveralls.io/github/sue445/activerecord-simple_index_name?branch=master)
8
9
  [![Code Climate](https://codeclimate.com/github/sue445/activerecord-simple_index_name/badges/gpa.svg)](https://codeclimate.com/github/sue445/activerecord-simple_index_name)
9
- [![Issue Count](https://codeclimate.com/github/sue445/activerecord-simple_index_name/badges/issue_count.svg)](https://codeclimate.com/github/sue445/activerecord-simple_index_name)
10
10
 
11
- TODO: Delete this and the text above, and describe your gem
11
+ ## Supported
12
+ * [Ruby on Rails](https://github.com/rails/rails)
13
+ * [Padrino](https://github.com/padrino/padrino-framework)
14
+ * or plain activerecord
12
15
 
13
16
  ## Installation
14
17
 
@@ -28,7 +31,21 @@ Or install it yourself as:
28
31
 
29
32
  ## Usage
30
33
 
31
- TODO: Write usage instructions here
34
+ When run `rake db:migrate` (or `rake ar:migrate`), index name will be automatically short.
35
+
36
+ ## Example
37
+ ```ruby
38
+ create_table :user_stocks do |t|
39
+ t.integer :user_id, null: false
40
+ t.integer :article_id, null: false
41
+ t.timestamps null: false
42
+ end
43
+
44
+ add_index :user_stocks, [:user_id, :article_id]
45
+ ```
46
+
47
+ * Index name without `activerecord-simple_index_name` : `index_user_stocks_on_user_id_and_article_id`
48
+ * Index name with `activerecord-simple_index_name` : `user_id_and_article_id`
32
49
 
33
50
  ## Development
34
51
 
@@ -38,10 +55,14 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
38
55
 
39
56
  ## Contributing
40
57
 
41
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/activerecord-simple_index_name.
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/activerecord-simple_index_name.
42
59
 
43
60
 
44
61
  ## License
45
62
 
46
63
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
47
64
 
65
+ ## Special thanks
66
+ [@kamipo](https://github.com/kamipo) :bow:
67
+
68
+ Original idea is http://qiita.com/kamipo/items/6e5a1e238d7cc0611ade (ja)
@@ -1,8 +1,10 @@
1
1
  module Activerecord
2
2
  module SimpleIndexName
3
3
  class Railtie < ::Rails::Railtie
4
- on_load :active_record do
5
- load "#{__dir__}/active_record_ext.rb"
4
+ initializer "simple_index_name.initializer" do
5
+ ActiveSupport.on_load(:active_record) do
6
+ require "activerecord/simple_index_name/active_record_ext"
7
+ end
6
8
  end
7
9
  end
8
10
  end
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module SimpleIndexName
3
- VERSION = "0.1.0.beta1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-simple_index_name
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
@@ -133,6 +133,7 @@ files:
133
133
  - ".gitignore"
134
134
  - ".rspec"
135
135
  - ".travis.yml"
136
+ - CHANGELOG.md
136
137
  - Gemfile
137
138
  - LICENSE.txt
138
139
  - README.md
@@ -162,9 +163,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
163
  version: '0'
163
164
  required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  requirements:
165
- - - ">"
166
+ - - ">="
166
167
  - !ruby/object:Gem::Version
167
- version: 1.3.1
168
+ version: '0'
168
169
  requirements: []
169
170
  rubyforge_project:
170
171
  rubygems_version: 2.4.5.1