private_person 0.3.0 → 0.3.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 +4 -4
- data/Gemfile +1 -2
- data/VERSION +1 -1
- data/lib/private_person/models/permission.rb +0 -3
- data/lib/private_person/models/permissor.rb +2 -4
- data/lib/private_person/models/permitted.rb +1 -1
- data/private_person.gemspec +4 -10
- data/spec/dummy/app/models/user.rb +12 -11
- data/spec/dummy/config/application.rb +1 -7
- data/spec/dummy/config/environments/development.rb +0 -7
- data/spec/dummy/config/environments/test.rb +0 -3
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +41 -26
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/models/permission_spec.rb +0 -11
- data/spec/spec_helper.rb +1 -1
- metadata +2 -19
- data/spec/dummy/app/models/follow.rb +0 -16
- data/spec/dummy/db/migrate/20130906211525_create_permissions_table.rb +0 -18
- data/spec/dummy/db/migrate/20130907010108_acts_as_follower_migration.rb +0 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ea4a8f4f6cabb8537ca689a8b83f58b09822b2f
|
|
4
|
+
data.tar.gz: ff11f0adc4df97999397aaeaec63893019c713d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b68dbebec12d3ce0cd05873c0adb64bec4e2159f1f1c9faaa1f602ac706577cc388c6a084f28963fbc29359f8e431913e5f6c3a68e8c4bc3dbcfbf255bccd3c
|
|
7
|
+
data.tar.gz: dbab508ccb006ca7907b91a82310af472f5d35d84f9446c33dafcecc1564d0b400f9b36952812838f837f5df5e5a29c193d4c76c404c081fb1181010514ff7c2
|
data/Gemfile
CHANGED
|
@@ -15,8 +15,7 @@ group :development, :test do
|
|
|
15
15
|
gem 'shoulda-matchers'
|
|
16
16
|
gem 'factory_girl_rails'
|
|
17
17
|
gem 'database_cleaner'
|
|
18
|
-
gem '
|
|
18
|
+
gem 'chalk_dust', :git => 'git://github.com/nerakdon/chalk_dust.git'
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
gem 'rails'
|
|
22
|
-
gem 'protected_attributes'
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.1
|
|
@@ -2,9 +2,6 @@ class Permission < ActiveRecord::Base
|
|
|
2
2
|
belongs_to :permissor, :polymorphic => true
|
|
3
3
|
belongs_to :permissible, :polymorphic => true
|
|
4
4
|
|
|
5
|
-
attr_accessible :permissible, :permissible_type, :permissible_id, :relationship_type
|
|
6
|
-
validates_presence_of :permissor, :permissible_type, :relationship_type
|
|
7
|
-
|
|
8
5
|
def self.by_permissor(permissor)
|
|
9
6
|
where("permissor_type = ? AND permissor_id = ?", permissor.class.name, permissor.id)
|
|
10
7
|
end
|
|
@@ -31,13 +31,11 @@ module PrivatePerson
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def permission_params(whom, what)
|
|
34
|
-
|
|
35
|
-
params.permit!
|
|
34
|
+
ActionController::Parameters.new({:relationship_type => whom, :permissible_type => what.class.name, :permissible_id => what.id}).permit!
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
def wildcard_permission_params(whom, what)
|
|
39
|
-
|
|
40
|
-
params.permit!
|
|
38
|
+
ActionController::Parameters.new({:relationship_type => whom, :permissible_type => what}).permit!
|
|
41
39
|
end
|
|
42
40
|
end
|
|
43
41
|
end
|
|
@@ -39,7 +39,7 @@ module PrivatePerson
|
|
|
39
39
|
# Then check for a slow method
|
|
40
40
|
for relationship_method in permissor.class.of
|
|
41
41
|
relationship_members = permissor.send(relationship_method.to_sym)
|
|
42
|
-
if relationship_members.present? and relationship_members.
|
|
42
|
+
if relationship_members.present? and relationship_members.include? self
|
|
43
43
|
return relationship_method.to_s
|
|
44
44
|
end
|
|
45
45
|
end
|
data/private_person.gemspec
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "private_person"
|
|
8
|
-
s.version = "0.3.
|
|
8
|
+
s.version = "0.3.1"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Karen Lundgren"]
|
|
@@ -38,7 +38,6 @@ Gem::Specification.new do |s|
|
|
|
38
38
|
"script/rails",
|
|
39
39
|
"spec/dummy/.rspec",
|
|
40
40
|
"spec/dummy/Rakefile",
|
|
41
|
-
"spec/dummy/app/models/follow.rb",
|
|
42
41
|
"spec/dummy/app/models/page.rb",
|
|
43
42
|
"spec/dummy/app/models/user.rb",
|
|
44
43
|
"spec/dummy/config.ru",
|
|
@@ -58,10 +57,8 @@ Gem::Specification.new do |s|
|
|
|
58
57
|
"spec/dummy/config/locales/en.yml",
|
|
59
58
|
"spec/dummy/config/routes.rb",
|
|
60
59
|
"spec/dummy/db/development.sqlite3",
|
|
61
|
-
"spec/dummy/db/migrate/20130906211525_create_permissions_table.rb",
|
|
62
60
|
"spec/dummy/db/migrate/20130906213557_create_users_table.rb",
|
|
63
61
|
"spec/dummy/db/migrate/20130906213612_create_pages_table.rb",
|
|
64
|
-
"spec/dummy/db/migrate/20130907010108_acts_as_follower_migration.rb",
|
|
65
62
|
"spec/dummy/db/schema.rb",
|
|
66
63
|
"spec/dummy/db/test.sqlite3",
|
|
67
64
|
"spec/dummy/script/rails",
|
|
@@ -88,7 +85,6 @@ Gem::Specification.new do |s|
|
|
|
88
85
|
|
|
89
86
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
90
87
|
s.add_runtime_dependency(%q<rails>, [">= 0"])
|
|
91
|
-
s.add_runtime_dependency(%q<protected_attributes>, [">= 0"])
|
|
92
88
|
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
|
93
89
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
|
94
90
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
|
@@ -98,10 +94,9 @@ Gem::Specification.new do |s|
|
|
|
98
94
|
s.add_development_dependency(%q<shoulda-matchers>, [">= 0"])
|
|
99
95
|
s.add_development_dependency(%q<factory_girl_rails>, [">= 0"])
|
|
100
96
|
s.add_development_dependency(%q<database_cleaner>, [">= 0"])
|
|
101
|
-
s.add_development_dependency(%q<
|
|
97
|
+
s.add_development_dependency(%q<chalk_dust>, [">= 0"])
|
|
102
98
|
else
|
|
103
99
|
s.add_dependency(%q<rails>, [">= 0"])
|
|
104
|
-
s.add_dependency(%q<protected_attributes>, [">= 0"])
|
|
105
100
|
s.add_dependency(%q<rdoc>, [">= 0"])
|
|
106
101
|
s.add_dependency(%q<bundler>, [">= 0"])
|
|
107
102
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
@@ -111,11 +106,10 @@ Gem::Specification.new do |s|
|
|
|
111
106
|
s.add_dependency(%q<shoulda-matchers>, [">= 0"])
|
|
112
107
|
s.add_dependency(%q<factory_girl_rails>, [">= 0"])
|
|
113
108
|
s.add_dependency(%q<database_cleaner>, [">= 0"])
|
|
114
|
-
s.add_dependency(%q<
|
|
109
|
+
s.add_dependency(%q<chalk_dust>, [">= 0"])
|
|
115
110
|
end
|
|
116
111
|
else
|
|
117
112
|
s.add_dependency(%q<rails>, [">= 0"])
|
|
118
|
-
s.add_dependency(%q<protected_attributes>, [">= 0"])
|
|
119
113
|
s.add_dependency(%q<rdoc>, [">= 0"])
|
|
120
114
|
s.add_dependency(%q<bundler>, [">= 0"])
|
|
121
115
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
@@ -125,7 +119,7 @@ Gem::Specification.new do |s|
|
|
|
125
119
|
s.add_dependency(%q<shoulda-matchers>, [">= 0"])
|
|
126
120
|
s.add_dependency(%q<factory_girl_rails>, [">= 0"])
|
|
127
121
|
s.add_dependency(%q<database_cleaner>, [">= 0"])
|
|
128
|
-
s.add_dependency(%q<
|
|
122
|
+
s.add_dependency(%q<chalk_dust>, [">= 0"])
|
|
129
123
|
end
|
|
130
124
|
end
|
|
131
125
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
class User < ActiveRecord::Base
|
|
2
|
-
acts_as_follower
|
|
3
|
-
acts_as_followable
|
|
4
|
-
|
|
5
2
|
acts_as_permissor :of => [:following_users, :user_followers, :following_of_followings, :follower_of_followers], :class_name => 'User'
|
|
6
3
|
|
|
4
|
+
def follow(user)
|
|
5
|
+
ChalkDust.subscribe(self, :to => user)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def following_users
|
|
9
|
+
ChalkDust.publishers_of(self)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def user_followers
|
|
13
|
+
ChalkDust.subscribers_of(self)
|
|
14
|
+
end
|
|
15
|
+
|
|
7
16
|
def following_of_followings
|
|
8
17
|
ids = []
|
|
9
18
|
for user in following_users
|
|
@@ -19,12 +28,4 @@ class User < ActiveRecord::Base
|
|
|
19
28
|
end
|
|
20
29
|
User.where(:id => ids)
|
|
21
30
|
end
|
|
22
|
-
|
|
23
|
-
def is_following_user_of?(item)
|
|
24
|
-
self.followed_by?(item)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def is_user_follower_of?(item)
|
|
28
|
-
item.followed_by?(self)
|
|
29
|
-
end
|
|
30
31
|
end
|
|
@@ -6,7 +6,7 @@ require "active_record/railtie"
|
|
|
6
6
|
|
|
7
7
|
Bundler.require
|
|
8
8
|
require "private_person"
|
|
9
|
-
require '
|
|
9
|
+
require 'chalk_dust'
|
|
10
10
|
|
|
11
11
|
module Dummy
|
|
12
12
|
class Application < Rails::Application
|
|
@@ -45,12 +45,6 @@ module Dummy
|
|
|
45
45
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
46
46
|
# like if you have constraints or database-specific column types
|
|
47
47
|
# config.active_record.schema_format = :sql
|
|
48
|
-
|
|
49
|
-
# Enforce whitelist mode for mass assignment.
|
|
50
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
|
51
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
|
52
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
|
53
|
-
config.active_record.whitelist_attributes = true
|
|
54
48
|
end
|
|
55
49
|
end
|
|
56
50
|
|
|
@@ -17,11 +17,4 @@ Dummy::Application.configure do
|
|
|
17
17
|
|
|
18
18
|
# Only use best-standards-support built into browsers
|
|
19
19
|
config.action_dispatch.best_standards_support = :builtin
|
|
20
|
-
|
|
21
|
-
# Raise exception on mass assignment protection for Active Record models
|
|
22
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
|
23
|
-
|
|
24
|
-
# Log the query plan for queries taking more than this (works
|
|
25
|
-
# with SQLite, MySQL, and PostgreSQL)
|
|
26
|
-
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
27
20
|
end
|
|
@@ -17,9 +17,6 @@ Dummy::Application.configure do
|
|
|
17
17
|
# Show full error reports and disable caching
|
|
18
18
|
config.consider_all_requests_local = true
|
|
19
19
|
|
|
20
|
-
# Raise exception on mass assignment protection for Active Record models
|
|
21
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
|
22
|
-
|
|
23
20
|
# Print deprecation notices to the stderr
|
|
24
21
|
config.active_support.deprecation = :stderr
|
|
25
22
|
end
|
|
Binary file
|
data/spec/dummy/db/schema.rb
CHANGED
|
@@ -9,48 +9,63 @@
|
|
|
9
9
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
|
10
10
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
|
11
11
|
#
|
|
12
|
-
# It's strongly recommended
|
|
13
|
-
|
|
14
|
-
ActiveRecord::Schema.define(:
|
|
15
|
-
|
|
16
|
-
create_table "
|
|
17
|
-
t.integer "
|
|
18
|
-
t.string "
|
|
19
|
-
t.
|
|
20
|
-
t.
|
|
21
|
-
t.
|
|
22
|
-
t.
|
|
23
|
-
t.
|
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
|
13
|
+
|
|
14
|
+
ActiveRecord::Schema.define(version: 20130930161545) do
|
|
15
|
+
|
|
16
|
+
create_table "activity_items", force: true do |t|
|
|
17
|
+
t.integer "performer_id"
|
|
18
|
+
t.string "performer_type"
|
|
19
|
+
t.string "event"
|
|
20
|
+
t.integer "target_id"
|
|
21
|
+
t.string "target_type"
|
|
22
|
+
t.integer "owner_id"
|
|
23
|
+
t.string "owner_type"
|
|
24
|
+
t.string "topic"
|
|
25
|
+
t.datetime "created_at"
|
|
26
|
+
t.datetime "updated_at"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
add_index "activity_items", ["owner_id", "owner_type", "created_at", "topic"], name: "activity_items_owner_id_type_created_at_topic"
|
|
30
|
+
add_index "activity_items", ["owner_id", "owner_type", "created_at"], name: "index_activity_items_on_owner_id_and_owner_type_and_created_at"
|
|
31
|
+
|
|
32
|
+
create_table "connections", force: true do |t|
|
|
33
|
+
t.integer "subscriber_id"
|
|
34
|
+
t.string "subscriber_type"
|
|
35
|
+
t.integer "publisher_id"
|
|
36
|
+
t.string "publisher_type"
|
|
37
|
+
t.string "topic"
|
|
38
|
+
t.datetime "created_at"
|
|
39
|
+
t.datetime "updated_at"
|
|
24
40
|
end
|
|
25
41
|
|
|
26
|
-
add_index "
|
|
27
|
-
add_index "follows", ["follower_id", "follower_type"], :name => "fk_follows"
|
|
42
|
+
add_index "connections", ["publisher_id", "publisher_type", "topic"], name: "index_connections_on_publisher_id_and_publisher_type_and_topic", unique: true
|
|
28
43
|
|
|
29
|
-
create_table "pages", :
|
|
44
|
+
create_table "pages", force: true do |t|
|
|
30
45
|
t.string "title"
|
|
31
46
|
t.text "body"
|
|
32
47
|
t.integer "user_id"
|
|
33
|
-
t.datetime "created_at"
|
|
34
|
-
t.datetime "updated_at"
|
|
48
|
+
t.datetime "created_at"
|
|
49
|
+
t.datetime "updated_at"
|
|
35
50
|
end
|
|
36
51
|
|
|
37
|
-
create_table "permissions", :
|
|
52
|
+
create_table "permissions", force: true do |t|
|
|
38
53
|
t.string "permissor_type"
|
|
39
54
|
t.integer "permissor_id"
|
|
40
55
|
t.string "permissible_type"
|
|
41
56
|
t.integer "permissible_id"
|
|
42
|
-
t.string "relationship_type", :
|
|
43
|
-
t.datetime "created_at"
|
|
44
|
-
t.datetime "updated_at"
|
|
57
|
+
t.string "relationship_type", default: "none"
|
|
58
|
+
t.datetime "created_at"
|
|
59
|
+
t.datetime "updated_at"
|
|
45
60
|
end
|
|
46
61
|
|
|
47
|
-
add_index "permissions", ["permissible_type", "permissible_id"], :
|
|
48
|
-
add_index "permissions", ["permissor_type", "permissor_id"], :
|
|
62
|
+
add_index "permissions", ["permissible_type", "permissible_id"], name: "index_permissions_on_permissible_type_and_permissible_id"
|
|
63
|
+
add_index "permissions", ["permissor_type", "permissor_id"], name: "index_permissions_on_permissor_type_and_permissor_id"
|
|
49
64
|
|
|
50
|
-
create_table "users", :
|
|
65
|
+
create_table "users", force: true do |t|
|
|
51
66
|
t.string "nickname"
|
|
52
|
-
t.datetime "created_at"
|
|
53
|
-
t.datetime "updated_at"
|
|
67
|
+
t.datetime "created_at"
|
|
68
|
+
t.datetime "updated_at"
|
|
54
69
|
end
|
|
55
70
|
|
|
56
71
|
end
|
data/spec/dummy/db/test.sqlite3
CHANGED
|
Binary file
|
|
@@ -5,17 +5,6 @@ describe Permission do
|
|
|
5
5
|
it { should belong_to(:permissor) }
|
|
6
6
|
it { should belong_to(:permissible) }
|
|
7
7
|
|
|
8
|
-
# Check accessible attributes
|
|
9
|
-
it { should allow_mass_assignment_of(:permissible) }
|
|
10
|
-
it { should allow_mass_assignment_of(:permissible_type) }
|
|
11
|
-
it { should allow_mass_assignment_of(:permissible_id) }
|
|
12
|
-
it { should allow_mass_assignment_of(:relationship_type) }
|
|
13
|
-
|
|
14
|
-
# Check validations
|
|
15
|
-
it { should validate_presence_of(:permissor) }
|
|
16
|
-
it { should validate_presence_of(:permissible_type) }
|
|
17
|
-
it { should validate_presence_of(:relationship_type) }
|
|
18
|
-
|
|
19
8
|
describe 'Class Methods' do
|
|
20
9
|
include_context 'permissions support'
|
|
21
10
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -13,7 +13,7 @@ FactoryGirl.definition_file_paths = %w(spec/factories)
|
|
|
13
13
|
|
|
14
14
|
require 'database_cleaner'
|
|
15
15
|
require 'shoulda-matchers'
|
|
16
|
-
require '
|
|
16
|
+
require 'chalk_dust'
|
|
17
17
|
require 'private_person'
|
|
18
18
|
|
|
19
19
|
# Requires supporting files with custom matchers and macros, etc,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: private_person
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Karen Lundgren
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - '>='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: protected_attributes
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - '>='
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - '>='
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: rdoc
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -165,7 +151,7 @@ dependencies:
|
|
|
165
151
|
- !ruby/object:Gem::Version
|
|
166
152
|
version: '0'
|
|
167
153
|
- !ruby/object:Gem::Dependency
|
|
168
|
-
name:
|
|
154
|
+
name: chalk_dust
|
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
|
170
156
|
requirements:
|
|
171
157
|
- - '>='
|
|
@@ -209,7 +195,6 @@ files:
|
|
|
209
195
|
- script/rails
|
|
210
196
|
- spec/dummy/.rspec
|
|
211
197
|
- spec/dummy/Rakefile
|
|
212
|
-
- spec/dummy/app/models/follow.rb
|
|
213
198
|
- spec/dummy/app/models/page.rb
|
|
214
199
|
- spec/dummy/app/models/user.rb
|
|
215
200
|
- spec/dummy/config.ru
|
|
@@ -229,10 +214,8 @@ files:
|
|
|
229
214
|
- spec/dummy/config/locales/en.yml
|
|
230
215
|
- spec/dummy/config/routes.rb
|
|
231
216
|
- spec/dummy/db/development.sqlite3
|
|
232
|
-
- spec/dummy/db/migrate/20130906211525_create_permissions_table.rb
|
|
233
217
|
- spec/dummy/db/migrate/20130906213557_create_users_table.rb
|
|
234
218
|
- spec/dummy/db/migrate/20130906213612_create_pages_table.rb
|
|
235
|
-
- spec/dummy/db/migrate/20130907010108_acts_as_follower_migration.rb
|
|
236
219
|
- spec/dummy/db/schema.rb
|
|
237
220
|
- spec/dummy/db/test.sqlite3
|
|
238
221
|
- spec/dummy/script/rails
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class Follow < ActiveRecord::Base
|
|
2
|
-
|
|
3
|
-
attr_accessible :followable_type, :followable_id
|
|
4
|
-
|
|
5
|
-
extend ActsAsFollower::FollowerLib
|
|
6
|
-
extend ActsAsFollower::FollowScopes
|
|
7
|
-
|
|
8
|
-
# NOTE: Follows belong to the "followable" interface, and also to followers
|
|
9
|
-
belongs_to :followable, :polymorphic => true
|
|
10
|
-
belongs_to :follower, :polymorphic => true
|
|
11
|
-
|
|
12
|
-
def block!
|
|
13
|
-
self.update_attribute(:blocked, true)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
class CreatePermissionsTable < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
create_table :permissions do |t|
|
|
4
|
-
t.string :permissor_type
|
|
5
|
-
t.integer :permissor_id
|
|
6
|
-
t.string :permissible_type
|
|
7
|
-
t.integer :permissible_id
|
|
8
|
-
t.string :relationship_type, :default => 'none'
|
|
9
|
-
t.timestamps
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
add_index :permissions, [:permissor_type, :permissor_id]
|
|
13
|
-
add_index :permissions, [:permissible_type, :permissible_id]
|
|
14
|
-
end
|
|
15
|
-
def self.down
|
|
16
|
-
drop_table :permissions
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
class ActsAsFollowerMigration < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
create_table :follows, :force => true do |t|
|
|
4
|
-
t.references :followable, :polymorphic => true, :null => false
|
|
5
|
-
t.references :follower, :polymorphic => true, :null => false
|
|
6
|
-
t.boolean :blocked, :default => false, :null => false
|
|
7
|
-
t.timestamps
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
add_index :follows, ["follower_id", "follower_type"], :name => "fk_follows"
|
|
11
|
-
add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.down
|
|
15
|
-
drop_table :follows
|
|
16
|
-
end
|
|
17
|
-
end
|