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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61fbf11fe24b73c2b0975cd1a1ef6d314af6a950
4
- data.tar.gz: f24f240308486d343a632111df59cb9debd3babc
3
+ metadata.gz: 99fbd74b980b8ac206a7d547ba0fe02b8a03b5e7
4
+ data.tar.gz: 572a31b6d3e239adc2d0d1a383750ba654e06736
5
5
  SHA512:
6
- metadata.gz: 858c8d538dfab2adf4fa12d9baa5bfdc04e781f0460ee91b39d7bdb044e395e1dc89ac5cfc54b5782c9a9a564511523b247349d462946d200717dba764822bc9
7
- data.tar.gz: d9b4168cb06941a77062ab2e5f840f450b9fefc485eed6ee6a341ce08b391d62edcde6087294db11fa1900288db44c349efd7b34abff43725a7dcbe242401ee9
6
+ metadata.gz: 769c4e7dca8016d8ea1ea3473f75590f1ea213cbad9111256898ebe7e0d1938f363143f97ac52552b4d2ecda0db5f39e4f024594c25bcf86ef14e14c0a1fa6b3
7
+ data.tar.gz: 2bbd6c74209d1c4fc72c8047dc386ecf2ac1ca7b549d3e15c8c713e171bfa0d163050d509c61471fc7600fdd5f5b3f4162985beb796d5934f5ddbcf56edb054c
@@ -0,0 +1,5 @@
1
+ deploy_branch: master
2
+ github_repo: sportngin/m2m_fast_insert
3
+ branches_to_keep:
4
+ - master
5
+ semantic_versioning: true
@@ -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: {}
@@ -12,8 +12,8 @@ rvm:
12
12
  - 2.1.10
13
13
  - 2.2.5
14
14
  script: bundle exec rake spec
15
- # Rails is not supported on Ruby 2.1.x
15
+ # Rails 5 is not supported on Ruby 2.1.x
16
16
  matrix:
17
17
  exclude:
18
18
  - rvm: 2.1.10
19
- gemfile: gemfiles/50.gemfile
19
+ gemfile: gemfiles/50.gemfile
@@ -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
- define_fast_methods_for_model(name, options)
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
@@ -1,3 +1,3 @@
1
1
  module M2MFastInsert
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -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.2.1
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-07-08 00:00:00.000000000 Z
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