1
をパラメータを必要としている。は、私は、ユーザーのサインで毎回チェックする必要があります(使用条件など)のチェックボックスを持って工夫のサインインに毎回
私は、チェックボックスを追加することで、いくつかの例を見てきましたサインアップページで、Userモデルに仮想属性を追加するなど
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
%p
= f.label :username, 'Username'
= f.text_field :username
%p
= f.label :password
= f.password_field :password
%p
%span
= check_box_tag :terms_of_use
I have read the
= link_to 'Terms of Use', '#'
%p
= f.submit 'Sign in'
ここに私の工夫ルートです:
devise_for :users, controllers: { sessions: 'sessions' }
そしてここでは、カスタムコントローラです:
class SessionsController < Devise::SessionsController
def create
if params[:terms_of_use]
super
else
# Not sure what to put here? Is this even the right track?
# Also, redirect the user back to the sign in page and let
# them know they must agree to the terms of use.
end
end
end
ユーザーがサインインするたびにチェックボックスを選択する必要はありますか?