質問するログイン新規登録

質問編集履歴

2

書式の改善

2019/10/30 09:51

投稿

k-810
k-810

スコア192

title CHANGED
File without changes
body CHANGED
@@ -21,6 +21,8 @@
21
21
  #####profile.rb
22
22
  ```
23
23
  class Profile < ApplicationRecord
24
+ has_many :coupon_profiles
25
+ has_many :coupons, through: :coupon_profiles
24
26
  accepts_nested_attributes_for :coupon_profiles
25
27
  end
26
28
  ```
@@ -28,6 +30,7 @@
28
30
  ```
29
31
  class Coupon < ApplicationRecord
30
32
  has_many :coupon_profiles
33
+ has_many :profiles, through: :coupon_profiles
31
34
  end
32
35
  ```
33
36
 

1

改善

2019/10/30 09:51

投稿

k-810
k-810

スコア192

title CHANGED
@@ -1,1 +1,1 @@
1
- rspec Factorybotの使い方 association
1
+ rspec】アソシエーションあるモデルを使いたい(Factorybot)
body CHANGED
File without changes