public_activity_multi_recipients 0.1.1 → 0.1.2

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: 7b09ef6b4a93509fe5dd237c03733b675333bf33
4
- data.tar.gz: fb9c9daf0e409a173b7446808ac983a9c0cdf90b
3
+ metadata.gz: 50fcf5ae225b96ed8084240a4bcf0681488faef5
4
+ data.tar.gz: 345f6e0104dc7a3883e21e20411420c9ef215847
5
5
  SHA512:
6
- metadata.gz: a7f8a235c6b24c48fc572ae4f0a2ff3c48cc980ab3d9298d3bf6ebd1d4397011f29ae6f810cfe9de6283c5b702554b7359a1f6c496094f2e44a5159870282a0f
7
- data.tar.gz: 2de82005fd48692042a2d171f3a26352b7159db9b9b58561185d5165a6f7fd6a93e052fec00f925bf40812ead1fb3c28875fdda777688cd2775a99f3b261cee5
6
+ metadata.gz: 1e3740b94a468330afc357beb1bc652768253df610f90e75666213c283c5b596554c850c8baed790319275b80ee5789f19261c6eb491275db79254c6c39ab6cc
7
+ data.tar.gz: 3b6cc164b6f894a7a6ddeee5d5fc81e44d64382b615fe65f769f5e6e4e90b382cc4c803d6c6e710f24d08a158e57b9ffedaa5034dbb41889b4fb58760534d6b4
@@ -0,0 +1,4 @@
1
+ PublicActivity::Activity.class_eval do
2
+ has_many :activity_recipients
3
+ has_many :recipients, through: :activity_recipients
4
+ end
@@ -1,2 +1,5 @@
1
1
  class ActivityRecipient < ApplicationRecord
2
+ belongs_to :activity
3
+ belongs_to :recipient, polymorphic: true
4
+
2
5
  end
@@ -2,7 +2,7 @@ class CreateActivityRecipients < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :activity_recipients do |t|
4
4
  t.references :activity, index: true
5
- t.references :recipient, :polymorphic: true, index: true
5
+ t.references :recipient, polymorphic: true, index: true
6
6
  t.timestamps
7
7
  end
8
8
  end
@@ -1,4 +1,18 @@
1
1
  module PublicActivityMultiRecipients
2
2
  class Engine < ::Rails::Engine
3
+ config.autoload_paths += %W(#{config.root}/lib)
4
+
5
+ class << self
6
+ def activate
7
+ ['app', 'lib'].each do |dir|
8
+ file = File.join(File.dirname(__FILE__), "../../#{dir}/**/*_decorator*.rb")
9
+ Dir.glob(file) do |c|
10
+ Rails.application.config.cache_classes ? require(c) : load(c)
11
+ end
12
+ end
13
+
14
+ config.to_prepare &method(:activate).to_proc
15
+ end
16
+ end
3
17
  end
4
18
  end
@@ -1,3 +1,3 @@
1
1
  module PublicActivityMultiRecipients
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: public_activity_multi_recipients
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kooinam
@@ -49,6 +49,7 @@ files:
49
49
  - README.md
50
50
  - Rakefile
51
51
  - app/assets/config/public_activity_multi_recipients_manifest.js
52
+ - app/models/activity_decorator.rb
52
53
  - app/models/activity_recipient.rb
53
54
  - app/models/application_record.rb
54
55
  - config/routes.rb