acts_as_favoritor 1.5.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/pull_request_template.md +2 -2
- data/CHANGELOG.md +6 -0
- data/DEPRECATIONS.md +3 -1
- data/INSTALL.md +1 -1
- data/README.md +35 -32
- data/acts_as_favoritor.gemspec +5 -5
- data/lib/acts_as_favoritor.rb +11 -2
- data/lib/acts_as_favoritor/configuration.rb +6 -27
- data/lib/acts_as_favoritor/favoritable.rb +3 -3
- data/lib/acts_as_favoritor/favoritor.rb +7 -7
- data/lib/acts_as_favoritor/favoritor_lib.rb +1 -1
- data/lib/acts_as_favoritor/version.rb +1 -1
- data/lib/generators/acts_as_favoritor_generator.rb +4 -7
- data/lib/generators/templates/initializer.rb +9 -0
- data/lib/generators/templates/migration.rb.erb +1 -1
- data/test/dummy30/config/initializers/acts_as_favoritor.rb +9 -0
- data/test/schema.rb +1 -1
- metadata +13 -12
- data/lib/generators/templates/acts_as_favoritor.yml.erb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e92b39df88d3baeafffbe37c4b0bb1592a4670c3549b7b8283f81ee69587e36a
|
4
|
+
data.tar.gz: f852795bafe8966bdd78c51bae2df98ddc68e90fced56192b78143ca77c8c4ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0bcce346eb37f9b0237435de80b842f2bf985490401a79cf6bde54446cca4d1446fbb9ef58e6074e61bdc7e0290d993b0ce811057695786a7d29e1503a7faeb
|
7
|
+
data.tar.gz: 0ed91c5554faac7434268f1afd3b2cdd9575ab975fbaee2c7499e2af887a17c3c953f955d95f88e33e692dc4c3789a1b99955df4cd6eb52a6f44f7e360107747
|
@@ -16,6 +16,6 @@ CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the f
|
|
16
16
|
|
17
17
|
Finally, if your pull request affects documentation or any non-code
|
18
18
|
changes, guidelines for those changes are [available
|
19
|
-
here](https://github.com/
|
19
|
+
here](https://github.com/jonhue/acts_as_favoritor/blob/master/CONTRIBUTING.md)
|
20
20
|
|
21
|
-
Thanks for contributing to
|
21
|
+
Thanks for contributing to acts_as_favoritor!
|
data/CHANGELOG.md
CHANGED
data/DEPRECATIONS.md
CHANGED
data/INSTALL.md
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# acts_as_favoritor
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/acts_as_favoritor.svg)](https://badge.fury.io/rb/acts_as_favoritor) <img src="https://travis-ci.org/jonhue/acts_as_favoritor.svg?branch=master" />
|
4
4
|
|
5
|
-
|
5
|
+
acts_as_favoritor is a Rubygem to allow any ActiveRecord model to associate any other model including the option for multiple relationships per association with scopes.
|
6
6
|
|
7
7
|
You are able to differentiate followers, favorites, watchers, votes and whatever else you can imagine through a single relationship. This is accomplished by a double polymorphic relationship on the Favorite model. There is also built in support for blocking/un-blocking favorite records as well as caching.
|
8
8
|
|
@@ -24,13 +24,14 @@ You are able to differentiate followers, favorites, watchers, votes and whatever
|
|
24
24
|
* [To Do](#to-do)
|
25
25
|
* [Contributing](#contributing)
|
26
26
|
* [Contributors](#contributors)
|
27
|
+
* [Semantic versioning](#semantic-versioning)
|
27
28
|
* [License](#license)
|
28
29
|
|
29
30
|
---
|
30
31
|
|
31
32
|
## Installation
|
32
33
|
|
33
|
-
|
34
|
+
acts_as_favoritor works with Rails 5.0 onwards. You can add it to your `Gemfile` with:
|
34
35
|
|
35
36
|
```ruby
|
36
37
|
gem 'acts_as_favoritor'
|
@@ -47,25 +48,17 @@ Or install it yourself as:
|
|
47
48
|
If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
|
48
49
|
|
49
50
|
```ruby
|
50
|
-
gem 'acts_as_favoritor', github: '
|
51
|
+
gem 'acts_as_favoritor', github: 'jonhue/acts_as_favoritor'
|
51
52
|
```
|
52
53
|
|
53
54
|
Now run the generator:
|
54
55
|
|
55
56
|
$ rails g acts_as_favoritor
|
56
57
|
|
57
|
-
You can set your default scope by passing `--scope custom_scope`. Learn more about scopes [here](#scopes).
|
58
|
-
|
59
|
-
If you specify `--cache true`, `acts_as_favoritor` will be using cache. Learn more about caching [here](#caching).
|
60
|
-
|
61
|
-
You can skip the creation of a configuration file by passing `--skip_configuration`. Learn more about configuring `acts_as_favoritor` [here](#configuration).
|
62
|
-
|
63
58
|
To wrap things up, migrate the changes into your database:
|
64
59
|
|
65
60
|
$ rails db:migrate
|
66
61
|
|
67
|
-
**Note:** Use `rake db:migrate` instead if you run Rails < 5.
|
68
|
-
|
69
62
|
This will create a Favorite model as well as a migration file.
|
70
63
|
|
71
64
|
## Usage
|
@@ -274,29 +267,33 @@ Favorite.all_list
|
|
274
267
|
|
275
268
|
### Caching
|
276
269
|
|
277
|
-
When you set the option `cache` in `config/acts_as_favoritor` to true, you are able to cache the amount of favorites/favoritables an instance has regarding a scope.
|
270
|
+
When you set the option `cache` in `config/initializers/acts_as_favoritor.rb` to true, you are able to cache the amount of favorites/favoritables an instance has regarding a scope.
|
278
271
|
|
279
272
|
For that you need to add some database columns:
|
280
273
|
|
281
274
|
*acts_as_favoritor*
|
282
275
|
|
283
276
|
```ruby
|
284
|
-
add_column :users, :
|
277
|
+
add_column :users, :favoritor_score, :text
|
278
|
+
add_column :users, :favoritor_total, :text
|
285
279
|
```
|
286
280
|
|
287
281
|
*acts_as_favoritable*
|
288
282
|
|
289
283
|
```ruby
|
290
|
-
add_column :users, :
|
291
|
-
add_column :
|
284
|
+
add_column :users, :favoritable_score, :text
|
285
|
+
add_column :users, :favoritable_total, :text
|
286
|
+
add_column :books, :favoritable_score, :text
|
287
|
+
add_column :books, :favoritable_total, :text
|
292
288
|
```
|
293
289
|
|
294
290
|
Caches are stored as hashes with scopes as keys:
|
295
291
|
|
296
292
|
```ruby
|
297
|
-
user.
|
298
|
-
|
299
|
-
|
293
|
+
user.favoritor_score # => { favorite: 1 }
|
294
|
+
user.favoritor_total # => { favorite: 1, watching: 1 }
|
295
|
+
second_user.favoritable_score # => { follow: 1 }
|
296
|
+
book.favoritable_score # => { favorite: 1 }
|
300
297
|
```
|
301
298
|
|
302
299
|
**Note:** Only scopes who have favorites are included.
|
@@ -315,17 +312,17 @@ book.favoritable_favorite_cache # => 1
|
|
315
312
|
|
316
313
|
## Configuration
|
317
314
|
|
318
|
-
|
319
|
-
|
320
|
-
When you delete this file, all settings will rollback to their defaults. You can prevent the creation of this configuration file when running the generator by passing the option `--skip_configuration`.
|
321
|
-
|
322
|
-
Currently supported Settings:
|
315
|
+
You can configure devise-onesignal by passing a block to `configure`. This can be done in `config/initializers/devise-onesignal.rb`:
|
323
316
|
|
324
|
-
|
317
|
+
```ruby
|
318
|
+
ActsAsFavoritor.configure do |config|
|
319
|
+
config.default_scope = 'follow'
|
320
|
+
end
|
321
|
+
```
|
325
322
|
|
326
|
-
|
323
|
+
**`default_scope`** Specify your default scope. Takes a string. Defaults to `'favorite'`. Learn more about scopes [here](#scopes).
|
327
324
|
|
328
|
-
|
325
|
+
**`cache`** Whether `acts_as_favoritor` uses caching or not. Takes a boolean. Defaults to `false`. Learn more about caching [here](#caching).
|
329
326
|
|
330
327
|
---
|
331
328
|
|
@@ -357,21 +354,27 @@ Test coverage can be calculated using SimpleCov. Make sure you have the [simplec
|
|
357
354
|
|
358
355
|
## To Do
|
359
356
|
|
360
|
-
|
357
|
+
[Here](https://github.com/jonhue/acts_as_favoritor/projects/1) is the full list of current projects.
|
358
|
+
|
359
|
+
To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/acts_as_favoritor/issues/new).
|
361
360
|
|
362
361
|
---
|
363
362
|
|
364
363
|
## Contributing
|
365
364
|
|
366
|
-
We hope that you will consider contributing to
|
365
|
+
We hope that you will consider contributing to acts_as_favoritor. Please read this short overview for some information about how to get started:
|
367
366
|
|
368
|
-
[Learn more about contributing to this repository](https://github.com/
|
367
|
+
[Learn more about contributing to this repository](https://github.com/jonhue/acts_as_favoritor/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/jonhue/acts_as_favoritor/blob/master/CODE_OF_CONDUCT.md)
|
369
368
|
|
370
369
|
### Contributors
|
371
370
|
|
372
371
|
Give the people some :heart: who are working on this project. See them all at:
|
373
372
|
|
374
|
-
https://github.com/
|
373
|
+
https://github.com/jonhue/acts_as_favoritor/graphs/contributors
|
374
|
+
|
375
|
+
### Semantic Versioning
|
376
|
+
|
377
|
+
acts_as_favoritor follows Semantic Versioning 2.0 as defined at http://semver.org.
|
375
378
|
|
376
379
|
## License
|
377
380
|
|
data/acts_as_favoritor.gemspec
CHANGED
@@ -7,9 +7,9 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.platform = Gem::Platform::RUBY
|
8
8
|
gem.summary = 'A Rubygem to add Favorite, Follow, Vote, etc. functionality to ActiveRecord models'
|
9
9
|
gem.description = 'acts_as_favoritor is a Rubygem to allow any ActiveRecord model to associate any other model including the option for multiple relationships per association with scopes. You are able to differentiate followers, favorites, watchers, votes and whatever else you can imagine through a single relationship. This is accomplished by a double polymorphic relationship on the Favorite model. There is also built in support for blocking/un-blocking favorite records as well as caching.'
|
10
|
-
gem.authors = '
|
11
|
-
gem.email = '
|
12
|
-
gem.homepage = 'https://
|
10
|
+
gem.authors = 'Jonas Hübotter'
|
11
|
+
gem.email = 'jonas.huebotter@gmail.com'
|
12
|
+
gem.homepage = 'https://github.com/jonhue/acts_as_favoritor'
|
13
13
|
gem.license = 'MIT'
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split("\n")
|
@@ -19,12 +19,12 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.required_ruby_version = '>= 2.3'
|
21
21
|
|
22
|
-
gem.add_dependency 'activerecord', '>=
|
22
|
+
gem.add_dependency 'activerecord', '>= 5.0'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'sqlite3', '~> 1.3'
|
25
25
|
gem.add_development_dependency 'shoulda_create', '~> 0.0'
|
26
26
|
gem.add_development_dependency 'shoulda', '~> 3.5'
|
27
27
|
gem.add_development_dependency 'factory_girl', '~> 4.8'
|
28
|
-
gem.add_development_dependency 'rails', '>=
|
28
|
+
gem.add_development_dependency 'rails', '>= 5.0'
|
29
29
|
gem.add_development_dependency 'tzinfo-data', '~> 1.2017'
|
30
30
|
end
|
data/lib/acts_as_favoritor.rb
CHANGED
@@ -2,6 +2,17 @@ require 'acts_as_favoritor/version'
|
|
2
2
|
|
3
3
|
module ActsAsFavoritor
|
4
4
|
|
5
|
+
autoload :Configuration, 'acts_as_favoritor/configuration'
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_accessor :configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.configure
|
12
|
+
self.configuration ||= Configuration.new
|
13
|
+
yield configuration
|
14
|
+
end
|
15
|
+
|
5
16
|
autoload :Favoritor, 'acts_as_favoritor/favoritor'
|
6
17
|
autoload :Favoritable, 'acts_as_favoritor/favoritable'
|
7
18
|
autoload :FavoritorLib, 'acts_as_favoritor/favoritor_lib'
|
@@ -9,6 +20,4 @@ module ActsAsFavoritor
|
|
9
20
|
|
10
21
|
require 'acts_as_favoritor/railtie' if defined?(Rails)
|
11
22
|
|
12
|
-
require 'acts_as_favoritor/configuration'
|
13
|
-
|
14
23
|
end
|
@@ -1,34 +1,13 @@
|
|
1
1
|
module ActsAsFavoritor
|
2
|
+
class Configuration
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
if config&.key :default_scope
|
6
|
-
config[:default_scope]
|
7
|
-
else
|
8
|
-
'favorite'
|
9
|
-
end
|
10
|
-
end
|
4
|
+
attr_accessor :default_scope
|
5
|
+
attr_accessor :cache
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
config[:cache]
|
16
|
-
else
|
17
|
-
false
|
7
|
+
def initialize
|
8
|
+
@default_scope = 'favorite'
|
9
|
+
@cache = false
|
18
10
|
end
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
private
|
23
11
|
|
24
|
-
|
25
|
-
def self.get_config
|
26
|
-
require 'yaml'
|
27
|
-
|
28
|
-
begin
|
29
|
-
YAML.load_file 'config/acts_as_favoritor.yml'
|
30
|
-
rescue Exception
|
31
|
-
end
|
32
12
|
end
|
33
|
-
|
34
13
|
end
|
@@ -11,7 +11,7 @@ module ActsAsFavoritor #:nodoc:
|
|
11
11
|
include ActsAsFavoritor::Favoritable::InstanceMethods
|
12
12
|
include ActsAsFavoritor::FavoritorLib
|
13
13
|
|
14
|
-
serialize :favoritable_cache, Hash if ActsAsFavoritor.cache
|
14
|
+
serialize :favoritable_cache, Hash if ActsAsFavoritor.configuration.cache
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -95,9 +95,9 @@ module ActsAsFavoritor #:nodoc:
|
|
95
95
|
elsif m.to_s[/(.+)_favoritors/]
|
96
96
|
favoritors_by_type $1.singularize.classify
|
97
97
|
elsif m.to_s[/favoritable_(.+)_score/]
|
98
|
-
favoritable_score[$1.singularize.classify] if ActsAsFavoritor.cache
|
98
|
+
favoritable_score[$1.singularize.classify] if ActsAsFavoritor.configuration.cache
|
99
99
|
elsif m.to_s[/favoritable_(.+)_total/]
|
100
|
-
favoritable_total[$1.singularize.classify] if ActsAsFavoritor.cache
|
100
|
+
favoritable_total[$1.singularize.classify] if ActsAsFavoritor.configuration.cache
|
101
101
|
else
|
102
102
|
super
|
103
103
|
end
|
@@ -11,7 +11,7 @@ module ActsAsFavoritor #:nodoc:
|
|
11
11
|
include ActsAsFavoritor::Favoritor::InstanceMethods
|
12
12
|
include ActsAsFavoritor::FavoritorLib
|
13
13
|
|
14
|
-
serialize :favoritor_cache, Hash if ActsAsFavoritor.cache
|
14
|
+
serialize :favoritor_cache, Hash if ActsAsFavoritor.configuration.cache
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -103,7 +103,7 @@ module ActsAsFavoritor #:nodoc:
|
|
103
103
|
elsif options[:multiple_scopes]
|
104
104
|
results = {}
|
105
105
|
options[:scope].each do |scope|
|
106
|
-
if ActsAsFavoritor.cache
|
106
|
+
if ActsAsFavoritor.configuration.cache
|
107
107
|
self.favoritor_score[scope] = self.favoritor_score[scope] + 1 || 1
|
108
108
|
self.favoritor_total[scope] = self.favoritor_total[scope] + 1 || 1
|
109
109
|
self.save!
|
@@ -118,7 +118,7 @@ module ActsAsFavoritor #:nodoc:
|
|
118
118
|
end
|
119
119
|
return results
|
120
120
|
else
|
121
|
-
if ActsAsFavoritor.cache
|
121
|
+
if ActsAsFavoritor.configuration.cache
|
122
122
|
self.favoritor_score[options[:scope]] = self.favoritor_score[options[:scope]] + 1 || 1
|
123
123
|
self.favoritor_total[options[:scope]] = self.favoritor_total[options[:scope]] + 1 || 1
|
124
124
|
self.save!
|
@@ -141,7 +141,7 @@ module ActsAsFavoritor #:nodoc:
|
|
141
141
|
elsif options[:multiple_scopes]
|
142
142
|
results = {}
|
143
143
|
options[:scope].each do |scope|
|
144
|
-
if ActsAsFavoritor.cache
|
144
|
+
if ActsAsFavoritor.configuration.cache
|
145
145
|
self.favoritor_score[scope] = self.favoritor_score[scope] - 1
|
146
146
|
self.favoritor_score.delete(scope) unless self.favoritor_score[scope] > 0
|
147
147
|
self.save!
|
@@ -155,7 +155,7 @@ module ActsAsFavoritor #:nodoc:
|
|
155
155
|
end
|
156
156
|
return results
|
157
157
|
else
|
158
|
-
if ActsAsFavoritor.cache
|
158
|
+
if ActsAsFavoritor.configuration.cache
|
159
159
|
self.favoritor_score[options[:scope]] = self.favoritor_score[options[:scope]] - 1
|
160
160
|
self.favoritor_score.delete(options[:scope]) unless self.favoritor_score[options[:scope]] > 0
|
161
161
|
self.save!
|
@@ -297,9 +297,9 @@ module ActsAsFavoritor #:nodoc:
|
|
297
297
|
elsif m.to_s[/favorited_(.+)/]
|
298
298
|
favorited_by_type $1.singularize.classify
|
299
299
|
elsif m.to_s[/favoritor_(.+)_score/]
|
300
|
-
favoritor_score[$1.singularize.classify] if ActsAsFavoritor.cache
|
300
|
+
favoritor_score[$1.singularize.classify] if ActsAsFavoritor.configuration.cache
|
301
301
|
elsif m.to_s[/favoritor_(.+)_total/]
|
302
|
-
favoritor_total[$1.singularize.classify] if ActsAsFavoritor.cache
|
302
|
+
favoritor_total[$1.singularize.classify] if ActsAsFavoritor.configuration.cache
|
303
303
|
else
|
304
304
|
super
|
305
305
|
end
|
@@ -37,7 +37,7 @@ module ActsAsFavoritor
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def validate_scopes method, options = {}
|
40
|
-
options[:scope] = options[:scope] || [ActsAsFavoritor.default_scope]
|
40
|
+
options[:scope] = options[:scope] || [ActsAsFavoritor.configuration.default_scope]
|
41
41
|
if options[:scope].size > 1
|
42
42
|
options[:multiple_scopes] = true
|
43
43
|
else
|
@@ -7,9 +7,6 @@ class ActsAsFavoritorGenerator < Rails::Generators::Base
|
|
7
7
|
|
8
8
|
source_root File.join File.dirname(__FILE__), 'templates'
|
9
9
|
desc 'Install acts_as_favoritor'
|
10
|
-
class_option :scope, desc: 'Specify your default scope. Learn more about scopes here: https://github.com/slooob/acts_as_favoritor#scopes', type: :string, default: 'favorite', aliases: '-s'
|
11
|
-
class_option :cache, desc: 'Enable caching. Learn more about caching here: https://github.com/slooob/acts_as_favoritor#caching', type: :boolean, default: false, aliases: '-c'
|
12
|
-
class_option :skip_configuration, desc: 'Skip the creation of the configuration file. Learn more about configuring acts_as_favoritor here: https://github.com/slooob/acts_as_favoritor#configuration', type: :boolean, default: false
|
13
10
|
|
14
11
|
def self.next_migration_number dirname
|
15
12
|
if ActiveRecord::Base.timestamped_migrations
|
@@ -19,6 +16,10 @@ class ActsAsFavoritorGenerator < Rails::Generators::Base
|
|
19
16
|
end
|
20
17
|
end
|
21
18
|
|
19
|
+
def create_initializer
|
20
|
+
template 'initializer.rb', 'config/initializers/acts_as_favoritor.rb'
|
21
|
+
end
|
22
|
+
|
22
23
|
def create_migration_file
|
23
24
|
migration_template 'migration.rb.erb', 'db/migrate/acts_as_favoritor_migration.rb', migration_version: migration_version
|
24
25
|
end
|
@@ -27,10 +28,6 @@ class ActsAsFavoritorGenerator < Rails::Generators::Base
|
|
27
28
|
template 'model.rb', 'app/models/favorite.rb'
|
28
29
|
end
|
29
30
|
|
30
|
-
def create_configuration
|
31
|
-
template 'acts_as_favoritor.yml.erb', 'config/acts_as_favoritor.yml' unless options[:skip_configuration]
|
32
|
-
end
|
33
|
-
|
34
31
|
def show_readme
|
35
32
|
readme 'README.md'
|
36
33
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
ActsAsFavoritor.configure do |config|
|
2
|
+
|
3
|
+
# Specify your default scope. Learn more about scopes here: https://github.com/jonhue/acts_as_favoritor#scopes
|
4
|
+
# config.default_scope = 'favorite'
|
5
|
+
|
6
|
+
# Enable caching. Learn more about caching here: https://github.com/jonhue/acts_as_favoritor#caching
|
7
|
+
# config.cache = false
|
8
|
+
|
9
|
+
end
|
@@ -3,7 +3,7 @@ class ActsAsFavoritorMigration < ActiveRecord::Migration<%= migration_version %>
|
|
3
3
|
create_table :favorites, force: true do |t|
|
4
4
|
t.references :favoritable, polymorphic: true, null: false
|
5
5
|
t.references :favoritor, polymorphic: true, null: false
|
6
|
-
t.string :scope, default: ActsAsFavoritor.default_scope, null: false, index: true
|
6
|
+
t.string :scope, default: ActsAsFavoritor.configuration.default_scope, null: false, index: true
|
7
7
|
t.boolean :blocked, default: false, null: false, index: true
|
8
8
|
t.timestamps
|
9
9
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
ActsAsFavoritor.configure do |config|
|
2
|
+
|
3
|
+
# Specify your default scope. Learn more about scopes here: https://github.com/jonhue/acts_as_favoritor#scopes
|
4
|
+
# config.default_scope = 'favorite'
|
5
|
+
|
6
|
+
# Enable caching. Learn more about caching here: https://github.com/jonhue/acts_as_favoritor#caching
|
7
|
+
# config.cache = false
|
8
|
+
|
9
|
+
end
|
data/test/schema.rb
CHANGED
@@ -5,7 +5,7 @@ ActiveRecord::Schema.define version: 0 do
|
|
5
5
|
t.string 'favoritable_type', null: false
|
6
6
|
t.integer 'favoritor_id', null: false
|
7
7
|
t.string 'favoritor_type', null: false
|
8
|
-
t.string :scope, default: ActsAsFavoritor.default_scope, null: false
|
8
|
+
t.string :scope, default: ActsAsFavoritor.configuration.default_scope, null: false
|
9
9
|
t.boolean 'blocked', default: false, null: false
|
10
10
|
t.datetime 'created_at'
|
11
11
|
t.datetime 'updated_at'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_favoritor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
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
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '5.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
|
-
version: '
|
96
|
+
version: '5.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: tzinfo-data
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ description: acts_as_favoritor is a Rubygem to allow any ActiveRecord model to a
|
|
114
114
|
and whatever else you can imagine through a single relationship. This is accomplished
|
115
115
|
by a double polymorphic relationship on the Favorite model. There is also built
|
116
116
|
in support for blocking/un-blocking favorite records as well as caching.
|
117
|
-
email:
|
117
|
+
email: jonas.huebotter@gmail.com
|
118
118
|
executables: []
|
119
119
|
extensions: []
|
120
120
|
extra_rdoc_files: []
|
@@ -144,7 +144,7 @@ files:
|
|
144
144
|
- lib/acts_as_favoritor/version.rb
|
145
145
|
- lib/generators/acts_as_favoritor_generator.rb
|
146
146
|
- lib/generators/templates/README.md
|
147
|
-
- lib/generators/templates/
|
147
|
+
- lib/generators/templates/initializer.rb
|
148
148
|
- lib/generators/templates/migration.rb.erb
|
149
149
|
- lib/generators/templates/model.rb
|
150
150
|
- test/acts_as_favoritable_test.rb
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- test/dummy30/config/environment.rb
|
166
166
|
- test/dummy30/config/environments/development.rb
|
167
167
|
- test/dummy30/config/environments/test.rb
|
168
|
+
- test/dummy30/config/initializers/acts_as_favoritor.rb
|
168
169
|
- test/dummy30/config/initializers/secret_token.rb
|
169
170
|
- test/dummy30/config/initializers/session_store.rb
|
170
171
|
- test/dummy30/config/locales/en.yml
|
@@ -175,14 +176,14 @@ files:
|
|
175
176
|
- test/favorite_test.rb
|
176
177
|
- test/schema.rb
|
177
178
|
- test/test_helper.rb
|
178
|
-
homepage: https://
|
179
|
+
homepage: https://github.com/jonhue/acts_as_favoritor
|
179
180
|
licenses:
|
180
181
|
- MIT
|
181
182
|
metadata: {}
|
182
183
|
post_install_message: |
|
183
184
|
**Thank you for installing acts_as_favoritor!**
|
184
185
|
Get started by running `rails g acts_as_favoritor`.
|
185
|
-
Learn more at https://github.com/
|
186
|
+
Learn more at https://github.com/jonhue/acts_as_favoritor.
|
186
187
|
rdoc_options: []
|
187
188
|
require_paths:
|
188
189
|
- lib
|
@@ -198,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
199
|
version: '0'
|
199
200
|
requirements: []
|
200
201
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.
|
202
|
+
rubygems_version: 2.7.3
|
202
203
|
signing_key:
|
203
204
|
specification_version: 4
|
204
205
|
summary: A Rubygem to add Favorite, Follow, Vote, etc. functionality to ActiveRecord
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# ----------
|
2
|
-
# ACTS AS FAVORITOR
|
3
|
-
# ----------
|
4
|
-
|
5
|
-
# Specify your default scope. Learn more about scopes here: https://github.com/slooob/acts_as_favoritor#scopes
|
6
|
-
default_scope: <%= options[:scope] %>
|
7
|
-
|
8
|
-
# Enable caching. Learn more about caching here: https://github.com/slooob/acts_as_favoritor#caching
|
9
|
-
cache: <%= options[:cache] %>
|