m2m_fast_insert 0.2.1 → 0.3.0
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.
- checksums.yaml +4 -4
- data/.octopolo.yml +5 -0
- data/.soyuz.yml +13 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.markdown +1 -0
- data/lib/m2m_fast_insert/has_and_belongs_to_many_override.rb +4 -3
- data/lib/m2m_fast_insert/version.rb +1 -1
- data/spec/support/test_model.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99fbd74b980b8ac206a7d547ba0fe02b8a03b5e7
|
|
4
|
+
data.tar.gz: 572a31b6d3e239adc2d0d1a383750ba654e06736
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 769c4e7dca8016d8ea1ea3473f75590f1ea213cbad9111256898ebe7e0d1938f363143f97ac52552b4d2ecda0db5f39e4f024594c25bcf86ef14e14c0a1fa6b3
|
|
7
|
+
data.tar.gz: 2bbd6c74209d1c4fc72c8047dc386ecf2ac1ca7b549d3e15c8c713e171bfa0d163050d509c61471fc7600fdd5f5b3f4162985beb796d5934f5ddbcf56edb054c
|
data/.octopolo.yml
ADDED
data/.soyuz.yml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
deploy_cmd: gem push *.gem
|
|
3
|
+
before_deploy_cmds:
|
|
4
|
+
- /usr/local/bin/op tag-release
|
|
5
|
+
- sed -i "" -e "s/\".*/\"$(git tag| sort -n -t. -k1,1 -k2,2 -k3,3 | tail -1 | sed s/v//)\"/" lib/m2m_fast_insert/version.rb
|
|
6
|
+
- git add lib/m2m_fast_insert/version.rb
|
|
7
|
+
- git commit -m "Version Bump" && git push
|
|
8
|
+
- gem build m2m_fast_insert.gemspec
|
|
9
|
+
after_deploy_cmds:
|
|
10
|
+
- rm *.gem
|
|
11
|
+
environments:
|
|
12
|
+
-
|
|
13
|
+
rubygems: {}
|
data/.travis.yml
CHANGED
data/CHANGELOG.markdown
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#### v0.3.0
|
|
@@ -3,10 +3,11 @@ module M2MFastInsert
|
|
|
3
3
|
# Decorate the original habtm to call our method definition
|
|
4
4
|
#
|
|
5
5
|
# name - Plural name of the model we're associating with
|
|
6
|
-
# options - see ActiveRecord docs
|
|
7
|
-
def has_and_belongs_to_many(name, options
|
|
6
|
+
# options - see ActiveRecord docs. Rails 4+ allows an optional proc in addition to the params
|
|
7
|
+
def has_and_belongs_to_many(name, *options)
|
|
8
8
|
super
|
|
9
|
-
|
|
9
|
+
m2m_options = options.last.is_a?(Hash) ? options.last : {}
|
|
10
|
+
define_fast_methods_for_model(name, m2m_options)
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
private
|
data/spec/support/test_model.rb
CHANGED
|
@@ -24,6 +24,9 @@ end
|
|
|
24
24
|
|
|
25
25
|
class User < ActiveRecord::Base
|
|
26
26
|
has_and_belongs_to_many :posts
|
|
27
|
+
if ActiveRecord::VERSION::MAJOR >= 4
|
|
28
|
+
has_and_belongs_to_many :posts_without_content, -> { where(content: nil) }, class_name: 'Post'
|
|
29
|
+
end
|
|
27
30
|
has_many :connections
|
|
28
31
|
has_many :friends, :through => :connections
|
|
29
32
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: m2m_fast_insert
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon Phenow
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -102,9 +102,12 @@ extensions: []
|
|
|
102
102
|
extra_rdoc_files: []
|
|
103
103
|
files:
|
|
104
104
|
- ".gitignore"
|
|
105
|
+
- ".octopolo.yml"
|
|
105
106
|
- ".rspec"
|
|
106
107
|
- ".ruby-version"
|
|
108
|
+
- ".soyuz.yml"
|
|
107
109
|
- ".travis.yml"
|
|
110
|
+
- CHANGELOG.markdown
|
|
108
111
|
- Gemfile
|
|
109
112
|
- MIT-LICENSE
|
|
110
113
|
- README.markdown
|