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

質問編集履歴

1

モデル、カラム、ログの追記

2021/07/14 07:21

投稿

maxi
maxi

スコア0

title CHANGED
File without changes
body CHANGED
@@ -99,7 +99,37 @@
99
99
  </script>
100
100
  </body>
101
101
  ```
102
+ ```model
103
+ class Campany < ApplicationRecord
102
104
 
105
+ has_many :campany_users
106
+ has_many :users, through: :campany_users
107
+ validates :name, presence: true
108
+ validates :code, presence: true
109
+
110
+ end
111
+ ```
112
+ ```table
113
+ create_table "campanies", force: :cascade do |t|
114
+ t.string "name"
115
+ t.string "code"
116
+ t.datetime "created_at", null: false
117
+ t.datetime "updated_at", null: false
118
+ end
119
+ ```
120
+ ```log
121
+ Started GET "/campanies/new?utf8=%E2%9C%93&authenticity_token=8OGnqKWkq07IxNVqajWFghxuJRdPphTleDMCUUsAPEBsdfNjiHj1q%2FgcSBNuSa1rm9VDxJnKnjFksbzWu3iRdA%3D%3D&campany%5Bname%5D=%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB&campany%5Bcode%5D=wGcDRsNr&commit=%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B" for 121.83.77.164 at 2021-07-14 07:16:01 +0000
122
+ Cannot render console from 121.83.77.164! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
123
+ Processing by CampaniesController#new as HTML
124
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"8OGnqKWkq07IxNVqajWFghxuJRdPphTleDMCUUsAPEBsdfNjiHj1q/gcSBNuSa1rm9VDxJnKnjFksbzWu3iRdA==", "campany"=>{"name"=>"株式会社サンプル", "code"=>"wGcDRsNr"}, "commit"=>"作成する"}
125
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]]
126
+ ↳ app/controllers/campanies_controller.rb:5
127
+ Rendering campanies/new.html.erb within layouts/application
128
+ Rendered campanies/new.html.erb within layouts/application (51.6ms)
129
+ Completed 200 OK in 118ms (Views: 114.2ms | ActiveRecord: 0.2ms)
130
+ ```
131
+
132
+
103
133
  ### 試したこと
104
134
  記述の見直し
105
135