質問編集履歴
2
msg add
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,7 +4,12 @@
|
|
4
4
|
|
5
5
|
code、あるいはnameだけ、など片方の場合は上手く登録出来ましたが、複数カラムある場合の記述が分かりません。
|
6
6
|
|
7
|
+
【2017/5/27追記】
|
8
|
+
どこを触ってしまったせいか、現在では独自パラメータ(codeまたはname)を1つでも追加したら登録出来なくなりました。
|
9
|
+
独自パラメータ無しの場合は、登録出来ます。
|
7
10
|
|
11
|
+
|
12
|
+
application_controller.rb
|
8
13
|
```ruby
|
9
14
|
class ApplicationController < ActionController::Base
|
10
15
|
protect_from_forgery with: :exception
|
@@ -35,12 +40,65 @@
|
|
35
40
|
|
36
41
|
宜しくお願い致します。
|
37
42
|
|
43
|
+
【ソースとエラーメッセージ追加】
|
44
|
+
実行時、最後の方に
|
45
|
+
「Filter chain halted as :require_no_authentication rendered or redirected
|
46
|
+
Completed 302 Found 」と、エラーらしきメッセージが出てます。
|
38
47
|
|
39
|
-
|
48
|
+
```dos
|
40
49
|
Started POST "/employees" for 127.0.0.1 at 2017-05-26 22:37:27 +0900
|
41
50
|
Processing by Devise::RegistrationsController#create as HTML
|
42
51
|
Parameters: {"utf8"=>"✓", "authenticity_token"=>"c25iAYc7fO7MdB4Ik3i1ljGByWd3F7zo7NX7z/ftf0YGTYbjwDvpP1aHl4Ac4VQvfk4338MJYvM35SCmHf2OTw==", "employee"=>{"code"=>"222", "name"=>"ほげさん", "email"=>"hoge@hoge.jp", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create Employee"}
|
43
52
|
Employee Load (0.2ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = ? ORDER BY "employees"."id" ASC LIMIT ? [["id", 4], ["LIMIT", 1]]
|
44
53
|
Redirected to http://localhost:3000/
|
45
54
|
Filter chain halted as :require_no_authentication rendered or redirected
|
46
|
-
Completed 302 Found in 4ms (ActiveRecord: 0.2ms)
|
55
|
+
Completed 302 Found in 4ms (ActiveRecord: 0.2ms)
|
56
|
+
```
|
57
|
+
|
58
|
+
routes.rb
|
59
|
+
```ruby
|
60
|
+
Rails.application.routes.draw do
|
61
|
+
devise_for :employees
|
62
|
+
resources :employees
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
ビュー側
|
67
|
+
_form.html.erb
|
68
|
+
```ruby
|
69
|
+
<div class="field">
|
70
|
+
<%= f.label :email %><br />
|
71
|
+
<%= f.email_field :email, autofocus: true %>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
<div class="field">
|
75
|
+
<%= f.label :password %>
|
76
|
+
<% if @minimum_password_length %>
|
77
|
+
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
78
|
+
<% end %><br />
|
79
|
+
<%= f.password_field :password, autocomplete: "off" %>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<div class="field">
|
83
|
+
<%= f.label :password_confirmation %><br />
|
84
|
+
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<div class="actions">
|
92
|
+
<%= f.submit %>
|
93
|
+
</div>
|
94
|
+
<% end %>
|
95
|
+
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
new.html.erb
|
100
|
+
```ruby
|
101
|
+
|
102
|
+
<%= link_to 'Back', employees_path %>
|
103
|
+
|
104
|
+
```
|
1
実行時のメッセージ
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,4 +33,14 @@
|
|
33
33
|
DeviseというよりはRailsの記述の問題かもしれませんが、
|
34
34
|
複数指定する場合の記述を教えていただけますでしょうか?
|
35
35
|
|
36
|
-
宜しくお願い致します。
|
36
|
+
宜しくお願い致します。
|
37
|
+
|
38
|
+
|
39
|
+
実行時のメッセージ
|
40
|
+
Started POST "/employees" for 127.0.0.1 at 2017-05-26 22:37:27 +0900
|
41
|
+
Processing by Devise::RegistrationsController#create as HTML
|
42
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"c25iAYc7fO7MdB4Ik3i1ljGByWd3F7zo7NX7z/ftf0YGTYbjwDvpP1aHl4Ac4VQvfk4338MJYvM35SCmHf2OTw==", "employee"=>{"code"=>"222", "name"=>"ほげさん", "email"=>"hoge@hoge.jp", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create Employee"}
|
43
|
+
Employee Load (0.2ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = ? ORDER BY "employees"."id" ASC LIMIT ? [["id", 4], ["LIMIT", 1]]
|
44
|
+
Redirected to http://localhost:3000/
|
45
|
+
Filter chain halted as :require_no_authentication rendered or redirected
|
46
|
+
Completed 302 Found in 4ms (ActiveRecord: 0.2ms)
|