質問編集履歴
1
モデル添付修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,8 +15,11 @@
|
|
15
15
|
get "profiles", to: "profiles#search"
|
16
16
|
end
|
17
17
|
```
|
18
|
-
### profile.
|
18
|
+
### profile.rb
|
19
19
|
```ruby
|
20
|
+
class Profile < ApplicationRecord
|
21
|
+
mount_uploader :image, ImageUploader
|
22
|
+
|
20
23
|
belongs_to :user
|
21
24
|
has_many :room_users, dependent: :destroy
|
22
25
|
has_many :rooms, through: :room_users
|
@@ -40,11 +43,21 @@
|
|
40
43
|
self.tags << new_profile_tag
|
41
44
|
end
|
42
45
|
end
|
46
|
+
end
|
43
47
|
```
|
44
48
|
### tag.rb
|
45
49
|
```ruby
|
50
|
+
class Tag < ApplicationRecord
|
46
|
-
has_many :profile_tags, dependent: :destroy
|
51
|
+
has_many :profile_tags, dependent: :destroy
|
47
|
-
has_many :tags, through: :profile_tags
|
52
|
+
has_many :tags, through: :profile_tags
|
53
|
+
end
|
54
|
+
```
|
55
|
+
### profile_tag.rb
|
56
|
+
```ruby
|
57
|
+
class ProfileTag < ApplicationRecord
|
58
|
+
belongs_to :profile
|
59
|
+
belongs_to :tag
|
60
|
+
end
|
48
61
|
```
|
49
62
|
### profiles_controller
|
50
63
|
```ruby
|