action-store 0.2.0 → 0.2.1

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: 8620df9bc8e7e653ee263d433f892c7cdca53033
4
- data.tar.gz: 73945fc330e36f657d39e2522e64572edac4a5ad
3
+ metadata.gz: '09651bb0002d5efaf81354d1b4ba5b62d62576a4'
4
+ data.tar.gz: 1d12ed61cdc42e0ff7d6c8d7fe9c63c09aee67bc
5
5
  SHA512:
6
- metadata.gz: 875ca9ea784edc3fbb850bf236aa81ebde12a5609cf184673cae8527c36da1716e45ebe7d8399c951183f2fd3640fcea79b586127a2b12a15b266a1a5905226d
7
- data.tar.gz: 0fd1ac9eadc6e0603d149d2b2bd781535b7dede284df05ec7eb7cbd5099a3f222c06cb29f9bedabe845f98cfa3e5933dea0ef7209f1de56c7512cfa4b2a57154
6
+ metadata.gz: bbee1cd45d4e30fab4f567745a4f4001048d7975b204f6810cba737b18e2af82d35e1bb7d9adef4d8e4851260950b70971381ba4612a1e6128fa664d17f57b95
7
+ data.tar.gz: c2fb0eca774924249021e6db24843643e49e9461c49fd717a1e2a862fabf4c3dfa0ab47f01d9c0bedf606905ea91ff844c93190316a79296680f4061556471b8
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.2.1
2
+ -----
3
+
4
+ - Use `ActiveSupport.on_load` to hook into Active Record.
5
+
1
6
  0.2.0
2
7
  -----
3
8
 
@@ -7,4 +12,4 @@
7
12
  0.1.0
8
13
  -----
9
14
 
10
- - First release.
15
+ - First release.
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  ActionStore
2
2
  -----------
3
3
 
4
- [![Gem Version](https://badge.fury.io/rb/action-store.svg)](https://badge.fury.io/rb/action-store) [![Build Status](https://travis-ci.org/rails-engine/action-store.svg)](https://travis-ci.org/rails-engine/action-store) [![Code Climate](https://codeclimate.com/github/rails-engine/action-store/badges/gpa.svg)](https://codeclimate.com/github/rails-engine/action-store) [![codecov.io](https://codecov.io/github/rails-engine/action-store/coverage.svg?branch=master)](https://codecov.io/github/rails-engine/action-store?branch=master) [![](http://inch-ci.org/github/rails-engine/action-store.svg?branch=master)](http://inch-ci.org/github/rails-engine/action-store?branch=master)
4
+ [![Gem Version](https://badge.fury.io/rb/action-store.svg)](https://badge.fury.io/rb/action-store) [![Build Status](https://travis-ci.org/rails-engine/action-store.svg)](https://travis-ci.org/rails-engine/action-store) [![Code Climate](https://codeclimate.com/github/rails-engine/action-store/badges/gpa.svg)](https://codeclimate.com/github/rails-engine/action-store) [![codecov.io](https://codecov.io/github/rails-engine/action-store/coverage.svg?branch=master)](https://codecov.io/github/rails-engine/action-store?branch=master)
5
5
 
6
- Store difference kind of actions (Like, Follow, Star, Block ...) in one table via ActiveRecord Polymorphic Association.
6
+ Store different kind of actions (Like, Follow, Star, Block ...) in one table via ActiveRecord Polymorphic Association.
7
7
 
8
8
  - Like Post/Comment/Reply ...
9
9
  - Watch/Subscribe Post
@@ -13,6 +13,8 @@ Store difference kind of actions (Like, Follow, Star, Block ...) in one table vi
13
13
 
14
14
  And more and more.
15
15
 
16
+ [中文介绍和使用说明](https://ruby-china.org/topics/32262)
17
+
16
18
  ## Basic table struct
17
19
 
18
20
  | Field | Means |
@@ -29,6 +31,16 @@ gem 'action-store'
29
31
 
30
32
  and run `bundle install`
31
33
 
34
+ Generate Migrations:
35
+
36
+ ```
37
+ $ rails g action_store:install
38
+ create config/initializers/action_store.rb
39
+ migration 20170208024704_create_actions.rb from action_store
40
+ ```
41
+
42
+ and run `rails db:migrate`.
43
+
32
44
  ### Define Actions
33
45
 
34
46
  You can use `action_store` to define actions:
@@ -175,4 +187,4 @@ And `User` model will have methods:
175
187
  - @user.unblock_user(@user1)
176
188
  - @user.like_post_ids
177
189
  - @user.block_user_ids
178
- - @user.block_by_user_ids
190
+ - @user.block_by_user_ids
@@ -18,4 +18,6 @@ module ActionStore
18
18
  end
19
19
  end
20
20
 
21
- ActiveRecord::Base.send(:include, ActionStore::Mixin)
21
+ ActiveSupport.on_load(:active_record) do
22
+ include ActionStore::Mixin
23
+ end
@@ -3,9 +3,9 @@ module ActionStore
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- # puts "Initalize ActionStore::Model"
6
+ # puts "Initialize ActionStore::Model"
7
7
  belongs_to :target, polymorphic: true
8
8
  belongs_to :user, polymorphic: true
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module ActionStore
2
- VERSION = "0.2.0"
3
- end
2
+ VERSION = "0.2.1"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee