Skip to content

Commit

Permalink
Install public_activity gem
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlON committed Feb 21, 2017
1 parent 90139d0 commit 333df11
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ gem 'font-awesome-rails'
gem 'jbuilder', '~> 2.5'
gem 'jquery-rails'
gem 'pg', '~> 0.18'
gem 'public_activity'
gem 'puma', '~> 3.0'
gem 'rails', '~> 5.0.1'
gem 'rainbow', '>= 2.1.0', '< 2.2.0' # workaround for bundler errors
Expand Down
8 changes: 7 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
public_activity (1.5.0)
actionpack (>= 3.0.0)
activerecord (>= 3.0)
i18n (>= 0.5.0)
railties (>= 3.0.0)
public_suffix (2.0.5)
puma (3.6.2)
rack (2.0.1)
Expand Down Expand Up @@ -327,6 +332,7 @@ DEPENDENCIES
launchy
listen (~> 3.0.5)
pg (~> 0.18)
public_activity
puma (~> 3.0)
rails (~> 5.0.1)
rails-assets-tether (>= 1.3.3)!
Expand All @@ -349,4 +355,4 @@ DEPENDENCIES
web-console (>= 3.3.0)

BUNDLED WITH
1.14.3
1.14.4
24 changes: 24 additions & 0 deletions db/migrate/20170221091555_create_activities.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Migration responsible for creating a table with activities
class CreateActivities < ActiveRecord::Migration
# Create table
def self.up
create_table :activities do |t|
t.belongs_to :trackable, polymorphic: true
t.belongs_to :owner, polymorphic: true
t.string :key
t.text :parameters
t.belongs_to :recipient, polymorphic: true

t.timestamps
end

add_index :activities, [:trackable_id, :trackable_type]
add_index :activities, [:owner_id, :owner_type]
add_index :activities, [:recipient_id, :recipient_type]
end

# Drop table
def self.down
drop_table :activities
end
end
22 changes: 14 additions & 8 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20_170_215_121_139) do
ActiveRecord::Schema.define(version: 20_170_221_091_555) do
# These are extensions that must be enabled in order to support this database
enable_extension 'plpgsql'

Expand All @@ -21,13 +21,20 @@
t.integer 'creator_id'
end

create_table 'invites', force: :cascade do |t|
t.integer 'room_id'
t.integer 'sender_id'
create_table 'activities', force: :cascade do |t|
t.string 'trackable_type'
t.integer 'trackable_id'
t.string 'owner_type'
t.integer 'owner_id'
t.string 'key'
t.text 'parameters'
t.string 'recipient_type'
t.integer 'recipient_id'
t.datetime 'created_at', null: false
t.datetime 'updated_at', null: false
t.index ['room_id'], name: 'index_invites_on_room_id', using: :btree
t.datetime 'created_at'
t.datetime 'updated_at'
t.index %w(owner_id owner_type), name: 'index_activities_on_owner_id_and_owner_type', using: :btree
t.index %w(recipient_id recipient_type), name: 'index_activities_on_recipient_id_and_recipient_type', using: :btree
t.index %w(trackable_id trackable_type), name: 'index_activities_on_trackable_id_and_trackable_type', using: :btree
end

create_table 'room_actions', id: false, force: :cascade do |t|
Expand Down Expand Up @@ -81,7 +88,6 @@
t.index ['room_id'], name: 'index_users_on_room_id', using: :btree
end

add_foreign_key 'invites', 'rooms'
add_foreign_key 'room_actions', 'actions'
add_foreign_key 'room_actions', 'rooms'
add_foreign_key 'room_requests', 'rooms'
Expand Down

0 comments on commit 333df11

Please sign in to comment.