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

質問編集履歴

3

ソースコードの追記

2020/05/27 00:16

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -96,4 +96,135 @@
96
96
  PostgreSQL 13beta1
97
97
  テキストエディタ Atom
98
98
 
99
- 失礼な点があるかもしれませんがどうぞ宜しくおねがい致します。
99
+ 失礼な点があるかもしれませんがどうぞ宜しくおねがい致します。
100
+
101
+
102
+ ### 追記
103
+ registrations_controller.rb
104
+ ```
105
+ # frozen_string_literal: true
106
+
107
+ class Users::RegistrationsController < Devise::RegistrationsController
108
+ # before_action :configure_sign_up_params, only: [:create]
109
+ # before_action :configure_account_update_params, only: [:update]
110
+
111
+ # GET /resource/sign_up
112
+ def new
113
+ super
114
+ @user = User.
115
+ end
116
+
117
+ # POST /resource
118
+ def create
119
+ super
120
+ @user = User.new(user_params)
121
+ if @user.save
122
+ flash[:notice] = "会員登録完了あなたは#{@user.id}人目のサービス利用者なので貢献度を#{@user.id}ポイントプレゼントします(´・ω・`)"
123
+ @imalevel = 1
124
+ @imalevel += @user.id
125
+ redirect_to("/")
126
+ else
127
+ flash[:alert] = "会員登録失敗"
128
+ render action: :new
129
+ end
130
+ end
131
+ # GET /resource/edit
132
+ def edit
133
+ super
134
+ end
135
+ # PUT /resource
136
+ def update
137
+ super
138
+ end
139
+
140
+ # DELETE /resource
141
+ def destroy
142
+ super
143
+ end
144
+
145
+ # GET /resource/cancel
146
+ # Forces the session data which is usually expired after sign
147
+ # in to be expired now. This is useful if the user wants to
148
+ # cancel oauth signing in/up in the middle of the process,
149
+ # removing all OAuth session data.
150
+ # def cancel
151
+ # super
152
+ # end
153
+ #
154
+ # protected
155
+
156
+ # If you have extra params to permit, append them to the sanitizer.
157
+ # def configure_sign_up_params
158
+ # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
159
+ # end
160
+ #
161
+ # If you have extra params to permit, append them to the sanitizer.
162
+ # def configure_account_update_params
163
+ # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
164
+ # end
165
+ #
166
+ # The path used after sign up.
167
+ # def after_sign_up_path_for(resource)
168
+ # super(resource)
169
+ # end
170
+ #
171
+ # The path used after sign up for inactive accounts.
172
+ # def after_inactive_sign_up_path_for(resource)
173
+ # super(resource)
174
+ # end
175
+ end
176
+ ```
177
+ これでhttp://localhost:3000/sinkiにアクセスすると発生するエラーメッセージ↓
178
+ ```
179
+ SyntaxError
180
+ C:/Users/r1148/butube/app/controllers/users/registrations_controller.rb:71: syntax error, unexpected end-of-input, expecting end
181
+ ```
182
+
183
+ 念のためroutes.rb↓
184
+ ```
185
+ Rails.application.routes.draw do
186
+ devise_for :users
187
+ get '/' => 'home#top'
188
+ devise_scope :user do
189
+ get 'login' => 'devise/sessions#new'
190
+ post 'login' => 'devise/sessions#create'
191
+ delete 'logout' => 'devise/sessions#destroy'
192
+ get 'sinki' => 'users/registrations#new'
193
+ post 'sinki' => 'devise/registrations#create'
194
+ get 'signup/cancel' => 'devise_invitable/registrations#cancel'
195
+ get 'user' => 'devise_invitable/registrations#edit'
196
+ patch 'user' => 'devise_invitable/registrations#update'
197
+ put 'user' => 'devise_invitable/registrations#update'
198
+ delete 'user' => 'devise_invitable/registrations#destroy'
199
+ get 'password' => 'devise/passwords#new'
200
+ post 'password' => 'devise/passwords#create'
201
+ get 'password/edit' => 'devise/passwords#edit'
202
+ patch 'password' => 'devise/passwords#update'
203
+ put 'password' => 'devise/passwords#update'
204
+ end
205
+ get 'you' => 'home#you'
206
+ post 'seikou' => 'home#seikou'
207
+ get 'kensaku' => 'video#kensaku'
208
+ get 'post' => 'post#new'
209
+ post 'arigatou' => 'post#create'
210
+ get 'index' => 'video#index'
211
+ get 'ionamata' => 'video#toukou'
212
+ post 'yosi!' => 'video#create'
213
+ get 'riyoukiyaku' => 'video#riyoukiyaku'
214
+ post 'kekka' => 'video#kekka'
215
+ get 'kesu' => 'home#kesu'
216
+ get 'kesu/taikai' => 'home#destroy'
217
+ resources :show do
218
+ member do
219
+ get 'star'
220
+ end
221
+ end
222
+ post 'hosi' => 'video#hosi'
223
+ resources :show do
224
+ member do
225
+ get 'komento'
226
+ end
227
+ end
228
+ get '/:id' => 'video#show'
229
+ end
230
+ ```

2

繁栄したコードの追記

2020/05/27 00:16

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,12 +1,12 @@
1
1
  ### 前提・実現したいこと
2
- Ruby on railsでページを表示させたいです。
2
+ Ruby on railsで「/sinki」に新規登録ページを表示させたいです。
3
3
  gem deviseを使用しています。
4
4
 
5
5
  ### 発生している問題
6
6
  エラーメッセージが表示されてページを閲覧できません。
7
7
 
8
8
  ### エラーメッセージ
9
- ![](fe11f5a6e31992c0965f5f95a529c87e.png)
9
+ ![](ead6a1dd2920c613185d17ab3f108604.png)
10
10
  ```
11
11
  SyntaxError
12
12
  C:/Users/r1148/butube/app/controllers/users/registrations_controller.rb:70: syntax error, unexpected end-of-input, expecting end
@@ -54,7 +54,7 @@
54
54
  def destroy
55
55
  super
56
56
  end
57
-
57
+ end
58
58
  # GET /resource/cancel
59
59
  # Forces the session data which is usually expired after sign
60
60
  # in to be expired now. This is useful if the user wants to
@@ -91,9 +91,9 @@
91
91
 
92
92
  ### 補足情報
93
93
  Windows 10 home 64ビット
94
- ruby 2.3.3
94
+ ruby 2.6.6
95
- Ruby on rails 5.2.4.3
95
+ Ruby on rails 6.0.3.1
96
- PostgreSQL 12.3
96
+ PostgreSQL 13beta1
97
97
  テキストエディタ Atom
98
98
 
99
99
  失礼な点があるかもしれませんがどうぞ宜しくおねがい致します。

1

追記

2020/05/27 00:01

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,20 +1,94 @@
1
1
  ### 前提・実現したいこと
2
- Ruby on railsで という機能実装したいです。
2
+ Ruby on railsでページ表示させたいです。
3
- 実現ことは です。
3
+ gem deviseを使用す。
4
4
 
5
5
  ### 発生している問題
6
+ エラーメッセージが表示されてページを閲覧できません。
6
7
 
7
8
  ### エラーメッセージ
9
+ ![](fe11f5a6e31992c0965f5f95a529c87e.png)
8
10
  ```
9
- コード
11
+ SyntaxError
12
+ C:/Users/r1148/butube/app/controllers/users/registrations_controller.rb:70: syntax error, unexpected end-of-input, expecting end
10
13
  ```
11
14
 
12
15
  ### 該当のソースコード
16
+ registrations_controller.rb
17
+ ```
18
+ # frozen_string_literal: true
13
19
 
20
+ class Users::RegistrationsController < Devise::RegistrationsController
21
+ # before_action :configure_sign_up_params, only: [:create]
22
+ # before_action :configure_account_update_params, only: [:update]
14
23
 
24
+ # GET /resource/sign_up
15
- ### 試したこと
25
+ def new
26
+ super
27
+ @user = User.
28
+ end
16
29
 
30
+ # POST /resource
31
+ def create
32
+ super
33
+ @user = User.new(user_params)
34
+ if @user.save
35
+ flash[:notice] = "会員登録完了あなたは#{@user.id}人目のサービス利用者なので貢献度を#{@user.id}ポイントプレゼントします(´・ω・`)"
36
+ @imalevel = 1
37
+ @imalevel += @user.id
38
+ redirect_to("/")
39
+ else
40
+ flash[:alert] = "会員登録失敗"
41
+ render action: :new
42
+ end
43
+ end
44
+ # GET /resource/edit
45
+ def edit
46
+ super
47
+ end
48
+ # PUT /resource
49
+ def update
50
+ super
51
+ end
17
52
 
53
+ # DELETE /resource
54
+ def destroy
55
+ super
56
+ end
57
+
58
+ # GET /resource/cancel
59
+ # Forces the session data which is usually expired after sign
60
+ # in to be expired now. This is useful if the user wants to
61
+ # cancel oauth signing in/up in the middle of the process,
62
+ # removing all OAuth session data.
63
+ # def cancel
64
+ # super
65
+ # end
66
+ #
67
+ # protected
68
+
69
+ # If you have extra params to permit, append them to the sanitizer.
70
+ # def configure_sign_up_params
71
+ # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
72
+ # end
73
+ #
74
+ # If you have extra params to permit, append them to the sanitizer.
75
+ # def configure_account_update_params
76
+ # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
77
+ # end
78
+ #
79
+ # The path used after sign up.
80
+ # def after_sign_up_path_for(resource)
81
+ # super(resource)
82
+ # end
83
+ #
84
+ # The path used after sign up for inactive accounts.
85
+ # def after_inactive_sign_up_path_for(resource)
86
+ # super(resource)
87
+ # end
88
+
89
+ ```
90
+
91
+
18
92
  ### 補足情報
19
93
  Windows 10 home 64ビット
20
94
  ruby 2.3.3