レールを扱うのは非常に新しいです。Devise を使用して基本的なログイン システムを実装しました。sign_up ページにいくつかの新しいフィールド (bio:string、name:string) を追加しようとしています。すべてが正しく表示され、新しいフィールドがデータベースに追加されますが (SQLbrowser で表示すると)、データが入力されず、ユーザーがサインアップ フォームを送信した後に次のようなメッセージが表示されます。
Unpermitted parameters: bio, name
2 つの文字列を _devise_create_users.rb に追加しました
# added
t.string :bio
t.string :name
そして、私はそれらをschema.rbに表示しています
ActiveRecord::Schema.define(version: 20130629002343) do
create_table "users", force: true do |t|
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
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"
t.datetime "updated_at"
t.string "shortbio"
t.boolean "admin", default: false
t.string "realname"
t.string "name"
t.string "bio"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
私のuser.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
#:token_authenticatable, :confirmable,
#:lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
この問題は強力なパラメーターと関係がありますか? それらと、どこで/どのように実装するかについて頭を悩ませています。