質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Q&A

0回答

710閲覧

新規登録画面にてsubmitを押しても更新しないと次に進まない

退会済みユーザー

退会済みユーザー

総合スコア0

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

0グッド

0クリップ

投稿2018/10/07 13:05

こんばんわ。

現在Ruby on Railsで新規登録画面の作成を行っております。

その中で、情報入力し、最後にsubmitをクリックしても反応せず、一度更新を押さないと登録が出来ない状態となっております。

以下がコードとなります

registrations_controller.rb

1class Users::RegistrationsController < Devise::RegistrationsController 2 # before_action :configure_sign_up_params, only: [:create] 3 # before_action :configure_account_update_params, only: [:update] 4 layout 'top', only: [:new] 5 # GET /resource/sign_up 6 def new 7 super 8 @company = Company.new 9 end 10 11 # POST /resource 12 def create 13 @company = Company.new(company_params) 14 if @company.valid? 15 super do |resource| 16 render(:new) && return if resource.errors.present? 17 @company.save 18 resource.update(company: @company) 19 end 20 end 21 end 22 end 23 24# GET /resource/edit 25# def edit 26# super 27# end 28 29# PUT /resource 30# def update 31# super 32# end 33 34# DELETE /resource 35# def destroy 36# super 37# end 38 39# GET /resource/cancel 40# Forces the session data which is usually expired after sign 41# in to be expired now. This is useful if the user wants to 42# cancel oauth signing in/up in the middle of the process, 43# removing all OAuth session data. 44# def cancel 45# super 46# end 47 48# protected 49 50# If you have extra params to permit, append them to the sanitizer. 51# def configure_sign_up_params 52# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute]) 53# end 54 55# If you have extra params to permit, append them to the sanitizer. 56# def configure_account_update_params 57# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) 58# end 59 60# The path used after sign up. 61# def after_sign_up_path_for(resource) 62# super(resource) 63# end 64 65# The path used after sign up for inactive accounts. 66# def after_inactive_sign_up_path_for(resource) 67# super(resource) 68# end 69 70private 71def company_params 72 params.require(:company).permit( 73 :company, 74 :first_name, 75 :last_name, 76 :first_kana, 77 :last_kana, 78 :tel, 79 :mobile, 80 :fax, 81 :e_mail, 82 :postnumber, 83 :prefecture, 84 :city, 85 :town, 86 :caption, 87 :labor_number, 88 :employment_number, 89 :trial_period, 90 :work_start, 91 :break_in, 92 :break_out, 93 :work_out, 94 :holiday, 95 :allowance, 96 :allowance_contents, 97 :closing_on, 98 :payment_on, 99 :method_payment, 100 :desuction 101 ) 102 end

regstration/new.html.erb

1 <div class="base-wrapper"> 2 3 4 <div class="heading"><h2>事業所登録</h2> 5 <p>会社情報を入力して下さい。</p></div> 6 7<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 8 <%= devise_error_messages! %> 9 10<table> 11 <colgroup> 12 <col width="40%"> 13 <col width="60%"> 14   </colgroup> 15 <tr> 16 <th>会社名<span class="label label-blue">必須</span></br> 17 <small>例)株式会社</small></th> 18 <td><%= text_field :company, :company %></td> 19 </tr> 20 <tr> 21 <th>代表者姓<span class="label label-blue">必須</span></br> 22 <small>例)山田</small></th> 23 <td><%= text_field :company, :first_name %></td> 24 </tr> 25 <tr> 26 <th>代表者名<span class="label label-blue">必須</span></br> 27 <small>例)太郎</small></th> 28 <td><%= text_field :company, :last_name %></td> 29 </tr> 30 <tr> 31 <th>ミョウジ<span class="label label-blue">必須</span></br> 32 <small>例)</small></th> 33 <td><%= text_field :company, :first_kana%></td> 34 </tr> 35 <tr> 36 <th>ナマエ<span class="label label-blue">必須</span></br> 37 <small>例)</small></th> 38 <td><%= text_field :company, :last_kana%></td> 39 </tr> 40 <tr> 41 <th>電話番号<span class="label label-blue">必須</span></br> 42 <small>例)</small></th> 43 <td><%= telephone_field :company, :tel%></td> 44 </tr> 45 <tr> 46 <th>電話番号<span class="label label-blue">必須</span></br> 47 <small>例)</small></th> 48 <td><%= telephone_field :company, :mobile%></td> 49 </tr> 50 <tr> 51 <th>FAX番号<span class="label label-blue">必須</span></br> 52 <small>例)</small></th> 53 <td><%= telephone_field :company, :fax%></td> 54 </tr> 55 <tr> 56 <th>メールアドレス<span class="label label-blue">必須</span></br> 57 <small>例)</small></th> 58 <td><%= email_field :company, :e_mail%></td> 59 </tr> 60 <tr> 61 <th>郵便番号<span class="label label-blue">必須</span></br> 62 <small>例)</small></th> 63 <td><%= number_field :company, :postnumber%></td> 64 </tr> 65 <tr> 66 <th>都道府県<span class="label label-blue">必須</span></br> 67 <small>例)</small></th> 68 <td><%= text_field :company, :prefecture %></td> 69 </tr> 70 <tr> 71 <th>市区町村<span class="label label-blue">必須</span></br> 72 <small>例)</small></th> 73 <td><%= text_field :company, :city %></td> 74 </tr> 75 <tr> 76 <th>市区町村以降<span class="label label-blue">必須</span></br> 77 <small>例)</small></th> 78 <td><%= text_field :company, :town %></td> 79 </tr> 80 <tr> 81 <th>資本金<span class="label label-blue">必須</span></br> 82 <small>例)</small></th> 83 <td><%= number_field :company, :caption%>万円</td> 84 </tr> 85 <tr> 86 <th>労働保険番号<span class="label label-blue">必須</span></br> 87 <small>例)1111-111111-111</small></th> 88 <td><%= number_field :company, :labor_number%></td> 89 </tr> 90 <tr> 91 <th>雇用保険番号<span class="label label-blue">必須</span></br> 92 <small>例)1111-111111-1</small></th> 93 <td><%= number_field :company, :employment_number%></td> 94 </tr> 95 </table> 96 97</div> 98 99 100 101 102 103 <div class="beige-wrapper"> 104 105 <div class="heading"><h2>就業規則</h2> 106 <p>就業情報を入力して下さい。</p></div> 107 108 109 <table> 110 <colgroup> 111 <col width="40%"> 112 <col width="60%"> 113   </colgroup> 114 <tr> 115 <th>試用期間<span class="label label-blue">必須</span></br> 116 <small>例)3ヶ月</small></th> 117 <td><%= text_field :employment, :trial_period%></td> 118 </tr> 119 <tr> 120 <th>勤務開始時間<span class="label label-blue">必須</span></br> 121 <small>例)10時00分</small></th> 122 <td><%= time_field :employment, :work_start%></td> 123 </tr> 124 <tr> 125 <th>休憩開始時間<span class="label label-blue">必須</span></br> 126 <small>例)12時00分</small></th> 127 <td><%= time_field :employment, :break_in%></td> 128 </tr> 129 <tr> 130 <th>休憩終了時間<span class="label label-blue">必須</span></br> 131 <small>例)13時00分</small></th> 132 <td><%= time_field :employment, :break_out %></td> 133 </tr> 134 <tr> 135 <th>勤務終了時間<span class="label label-blue">必須</span></br> 136 <small>例)19時00分</small></th> 137 <td><%= time_field :employment, :work_out%></td> 138 </tr> 139 <tr> 140 <th>休日<span class="label label-blue">必須</span></br> 141 <small>例)火曜日</small></th> 142 <td><%= text_field :employment, :holiday%></td> 143 </tr> 144 <tr> 145 <th>手当<span class="label label-blue">必須</span></br> 146 <small>例)売上歩合</small></th> 147 <td><%= text_field :employment, :allowance%></td> 148 </tr> 149 <tr> 150 <th>手当詳細<span class="label label-blue">必須</span></br> 151 <small>例)売上の5%</small></th> 152 <td><%= text_field :employment, :allowance_contents%></td> 153 </tr> 154 <tr> 155 <th>締め日<span class="label label-blue">必須</span></br> 156 <small>例)31日</small></th> 157 <td><%= text_field :employment, :closing_on%>日</td> 158 </tr> 159 <tr> 160 <th>支払い日<span class="label label-blue">必須</span></br> 161 <small>例)5日</small></th> 162 <td><%= text_field :employment, :payment_on%>日</td> 163 </tr> 164 <tr> 165 <th>支払方法<span class="label label-blue">必須</span></br> 166 <small>例)銀行振込</small></th> 167 <td><%= text_field :employment, :method_payment %>日</td> 168 </tr> 169 <tr> 170 <th>控除<span class="label label-blue">必須</span></br> 171 <small>例)雇用保険・厚生年金・健康保険・源泉徴収</small></th> 172 <td><%= radio_button :employment, :desuction,'雇用保険'%>雇用保険 173 <%= radio_button :employment, :desuction,'厚生年金'%>厚生年金 174 <%= radio_button :employment, :desuction,'健康保険'%>健康保険 175 <%= radio_button :employment, :desuction,'介護保険'%>介護保険 176 <%= radio_button :employment, :desuction,'源泉徴収'%>源泉徴収 177 <%= radio_button :employment, :desuction,'住民税'%>住民税 178 </td> 179 </tr> 180 </table> 181 182</div> 183 184 <div class="green-wrapper"> 185 186 <div class="heading"><h2>ログイン情報</h2> 187 <p>ID/PASSを入力して下さい。</p></div> 188 189 190 <table> 191 <colgroup> 192 <col width="40%"> 193 <col width="60%"> 194   </colgroup> 195 <tr> 196 <th>ログインアドレス<span class="label label-blue">必須</span></br> 197 <small>aaa@crold-valieat.jp</small></th> 198 <td> <%= f.email_field :email, autofocus: true, autocomplete: "email" %></td> 199 </tr> 200 <tr> 201 <th>パスワード<span class="label label-blue">必須</span></br> 202 <small>*******</small></th> 203 <td><% if @minimum_password_length %> 204 <% end %> 205 <%= f.password_field :password, autocomplete: "off" %></td> 206 </tr> 207 <tr> 208 <th>パスワード<span class="label label-blue">必須</span></br> 209 <small>******</small></th> 210 <td><%= f.password_field :password_confirmation, autocomplete: "off" %> 211 </td> 212 </tr> 213 <tr> 214 <th colspan="2"><%= f.submit "同意して登録" %></th> 215 </tr> 216 </table> 217<% end %> 218

以上、よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問