partisan 0.4.2 → 0.5

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: d936bacfb75a4439cfa641e0dc3f021f4eeefd0d
4
- data.tar.gz: ceba8e18ebb77675bd10d141165a31321f552c8d
3
+ metadata.gz: 34e1fc2af5b77d30d9f279c2217ac74d28f6c1f2
4
+ data.tar.gz: 86500ae07a16b4538c98ade54751295c8f62961f
5
5
  SHA512:
6
- metadata.gz: 91469d38973cada18bb4ce7827e33b012b9fc55580b93cfafc24d8fad8be2a26e1b5c4cee53111704063a0afc7390fb313efbf41c7c6620c6e23cf510922d293
7
- data.tar.gz: a3952e8a4e978691f966fc144bcfcb9a2c37f5056fe9e1e737b00d8893612499be3abae243fbf0399424b8c34e53a188b244660e8106e2947ca5b0809beaee40
6
+ metadata.gz: 8ab7dfac955e6db1c6741d6e7737629ee2a31331d355368e2118f14ea05c850bb527c8880fd1dd9ca39f82a443a0e5dbde1cc7c8713e5a3ff04122295d5ac575
7
+ data.tar.gz: 311eed5f77657c68e0498491cbccfe12dd028605d47fc27bfb02ce14db267deb0ce86021ede16ac52ce93b53ade06d70439d248c9bacf53e040c505efb8fd601
@@ -3,11 +3,10 @@ sudo: false
3
3
  language: ruby
4
4
 
5
5
  rvm:
6
- - 2.2
7
- - 2.1
8
- - 2.0
6
+ - 2.2.2
9
7
 
10
8
  gemfile:
9
+ - gemfiles/Gemfile.activerecord-5.0
11
10
  - gemfiles/Gemfile.activerecord-4.2
12
11
  - gemfiles/Gemfile.activerecord-4.1
13
12
 
data/README.md CHANGED
@@ -22,7 +22,7 @@ It’s heavily inspired by `acts_as_follower`. However, it’s not 100% compatib
22
22
  But I also added awesome new ones:
23
23
 
24
24
  * You can use `following_team_ids` but also `following_team_names` (basically any `following_team_<column>s`). It takes advantage of the `pluck` method, so it doesn’t create an instance of each follower, it just return the relevant column values. (Go check `pluck` documentation, it’s simply awesome).
25
- * The `followers` and `followings` methods now return an `ActiveRecord::Relation` for easy chaining, scoping, counting, pagination, etc.
25
+ * The `follows` and `followings` methods now return an `ActiveRecord::Relation` for easy chaining, scoping, counting, pagination, etc.
26
26
 
27
27
  ## Installation
28
28
 
@@ -72,6 +72,9 @@ fan.follow(band)
72
72
  fan.following_bands
73
73
  # => [<Band id=2>]
74
74
 
75
+ band.fan_followers
76
+ # => [<Fan id=1>]
77
+
75
78
  fan.follows?(band)
76
79
  # => true
77
80
 
@@ -89,7 +92,7 @@ However, if the *followed* record has a `followers_count` column, Partisan will
89
92
  ```ruby
90
93
  fan.follow(band)
91
94
 
92
- band.followers.count
95
+ band.followings.count
93
96
  # SQL query that counts records and returns `1`
94
97
 
95
98
  band.followers_count
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'activerecord', '~> 5.0.0'
@@ -9,7 +9,7 @@ module Partisan
9
9
  klass ||= obj.object.class if obj.respond_to?(:object) && obj.object.class < ActiveRecord::Base
10
10
 
11
11
  # In case we’re using STI, loop back until we find the top-level ActiveRecord model
12
- klass = klass.superclass while klass.superclass != ActiveRecord::Base
12
+ klass = klass.superclass while !klass.superclass.abstract_class && klass.superclass != ActiveRecord::Base
13
13
 
14
14
  klass.name
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Partisan
2
- VERSION = '0.4.2'
2
+ VERSION = '0.5'
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(spec)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'activerecord', '>= 3.0.0'
21
+ spec.add_dependency 'activerecord', '>= 5.0.0'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1.3'
24
24
  spec.add_development_dependency 'rake'
@@ -24,6 +24,18 @@ describe Partisan::Helper do
24
24
  it { expect(parent_class_name).to eql 'Article' }
25
25
  end
26
26
 
27
+ context 'with object that inherits from abstract class' do
28
+ let(:object) do
29
+ spawn_model('ApplicationRecord', ActiveRecord::Base) do
30
+ self.abstract_class = true
31
+ end
32
+
33
+ spawn_model('Article', ApplicationRecord).new
34
+ end
35
+
36
+ it { expect(parent_class_name).to eql 'Article' }
37
+ end
38
+
27
39
  context 'with a presented record object' do
28
40
  let(:presenter_class) do
29
41
  Class.new(::SimpleDelegator) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: partisan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Prévost
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-04 00:00:00.000000000 Z
12
+ date: 2016-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 3.0.0
20
+ version: 5.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 3.0.0
27
+ version: 5.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,7 @@ files:
100
100
  - Rakefile
101
101
  - gemfiles/Gemfile.activerecord-4.1
102
102
  - gemfiles/Gemfile.activerecord-4.2
103
+ - gemfiles/Gemfile.activerecord-5.0
103
104
  - lib/generators/partisan/USAGE
104
105
  - lib/generators/partisan/install_generator.rb
105
106
  - lib/generators/partisan/templates/migration.rb
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
139
  version: '0'
139
140
  requirements: []
140
141
  rubyforge_project:
141
- rubygems_version: 2.4.5
142
+ rubygems_version: 2.5.1
142
143
  signing_key:
143
144
  specification_version: 4
144
145
  summary: Partisan is a Ruby library that allows ActiveRecord records to be follower