1
ユーザをユーザ名deviseに登録するにはどうすればよいですか?デビットエラー:許可されていないパラメータ
Error:
Processing by Devise::SessionsController#new as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"oa1sf2dgKU/VpgOAI5ocnM8e5gNkuswxX9KKpTLFUZmUwtO40CFoseZiYQ3eQZ71bTw9R3aFOhpbD5EZcAVcGA==", "user"=>{"username"=>"MCarpintini", "email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Register"}
Unpermitted parameters: :username, :password_confirmation
登録フォーム
.ui.middle.aligned.center.aligned.grid
.column
=form_for(resource, html: {class:"ui large form"}, as: resource_name,url: session_path(resource_name)) do |f|
.ui.stacked.segment
.field
.ui.left.icon.input
%i{class:"user icon"}
=f.text_field :username, placeholder: "Username"
.field
.ui.left.icon.input
%i{class:"mail icon"}
=f.email_field :email, placeholder:"Email"
.field
.ui.left.icon.input
%i{class:"lock icon"}
=f.password_field :password, placeholder:"Password"
.field
.ui.left.icon.input
%i{class:"repeat icon"}
=f.password_field :password_confirmation, placeholder:"Password Confirmation"
=f.submit "Register", class:"ui fluid large teal submit button"
.ui.error.message
.ui.message
Do you have account?
=link_to "Login", new_user_session_path
Userモデル
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
Userテーブル構造:私は今のところ私に次のエラーがスローされている何 。
create_table "users", force: :cascade do |t|
t.string "username", default: "", null: false
t.string "avatar_file_name", default: "", null: false
t.string "avatar_content_type", default: "", null: false
t.integer "avatar_file_size", null: false
t.datetime "avatar_updated_at", null: false
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
は私に同じエラーを与える、私は何か他のものに変更する必要がありますか?ありがとう! –
@MatiasCarpintini。上記のフィルターはどこに追加しましたか? – hjpotter92
'app/controllers/users/registrations_controller.rb' –