質問編集履歴

2

rake routesの追加

2020/01/13 22:36

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -210,6 +210,74 @@
210
210
 
211
211
  ```
212
212
 
213
+ rake routesをすると...
214
+
215
+ ```
216
+
217
+ Controller#Action
218
+
219
+ new_account_session GET /accounts/sign_in(.:format) devise/sessions#new
220
+
221
+ account_session POST /accounts/sign_in(.:format) devise/sessions#create
222
+
223
+ destroy_account_session DELETE /accounts/sign_out(.:format) devise/sessions#destroy
224
+
225
+ new_account_password GET /accounts/password/new(.:format) devise/passwords#new
226
+
227
+ edit_account_password GET /accounts/password/edit(.:format) devise/passwords#edit
228
+
229
+ account_password PATCH /accounts/password(.:format) devise/passwords#update
230
+
231
+ PUT /accounts/password(.:format) devise/passwords#update
232
+
233
+ POST /accounts/password(.:format) devise/passwords#create
234
+
235
+ cancel_account_registration GET /accounts/cancel(.:format) devise/registrations#cancel
236
+
237
+ new_account_registration GET /accounts/sign_up(.:format) devise/registrations#new
238
+
239
+ edit_account_registration GET /accounts/edit(.:format) devise/registrations#edit
240
+
241
+ account_registration PATCH /accounts(.:format) devise/registrations#update
242
+
243
+ PUT /accounts(.:format) devise/registrations#update
244
+
245
+ DELETE /accounts(.:format) devise/registrations#destroy
246
+
247
+ POST /accounts(.:format) devise/registrations#create
248
+
249
+ static_pages_home GET /static_pages/home(.:format) static_pages#home
250
+
251
+ root GET / static_pages#home
252
+
253
+ home GET /home(.:format) static_pages#home
254
+
255
+ howto GET /howto(.:format) static_pages#howto
256
+
257
+ accounts_sign_up GET /accounts/sign_up(.:format) devise/registrations#new
258
+
259
+ accounts_index GET /accounts/index(.:format) accounts#index
260
+
261
+ profile GET /accounts/profile/:id(.:format) accounts#show
262
+
263
+ accounts GET /accounts(.:format) accounts#index
264
+
265
+ POST /accounts(.:format) accounts#create
266
+
267
+ new_account GET /accounts/new(.:format) accounts#new
268
+
269
+ edit_account GET /accounts/:id/edit(.:format) accounts#edit
270
+
271
+ account GET /accounts/:id(.:format) accounts#show
272
+
273
+ PATCH /accounts/:id(.:format) accounts#update
274
+
275
+ PUT /accounts/:id(.:format) accounts#update
276
+
277
+ DELETE /accounts/:id(.:format) accounts#destroy
278
+
279
+ ```
280
+
213
281
 
214
282
 
215
283
  railsを勉強して自分のアプリを作ろうとした時に起きた問題です。

1

モデルを追加しました

2020/01/13 22:36

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -168,6 +168,50 @@
168
168
 
169
169
  ```
170
170
 
171
+ account.rb
172
+
173
+ ```
174
+
175
+ class Account < ApplicationRecord
176
+
177
+ # Include default devise modules. Others available are:
178
+
179
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
180
+
181
+ devise :database_authenticatable, :registerable,
182
+
183
+ :recoverable, :rememberable, :validatable
184
+
185
+ has_many :active_relationships,
186
+
187
+ class_name: "Relationship",
188
+
189
+ foreign_key: "follower_id",
190
+
191
+ dependent: :destroy
192
+
193
+ end
194
+
195
+
196
+
197
+ ```
198
+
199
+ application_record.rb
200
+
201
+ ```
202
+
203
+ class ApplicationRecord < ActiveRecord::Base
204
+
205
+ self.abstract_class = true
206
+
207
+ end
208
+
209
+
210
+
211
+ ```
212
+
213
+
214
+
171
215
  railsを勉強して自分のアプリを作ろうとした時に起きた問題です。
172
216
 
173
217
  「idが渡されていない」という事が問題だと思うのですが、具体的に自分がどのようにしてコードを書くべきなのかが良くわからなかったため投稿させていただきました。