おはよう、
サインアップに問題があります。私は手動でテストしてきましたが、サインアップはフィールドを通過していません。私は強力なパラメーターを設定しましたが、それらを使用せずに古い attr_accessible を使用してみましたが、違いはありません。
他の誰かが以前にこの問題を抱えていましたか?
application_controller.rb
class ApplicationController < ActionController::Base
before_filter :configure_permitted_parameters, if: :devise_controller?
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:first_name, :last_name, :profile_name, :email, :password, :password_confirmation,
:confirmation_token, :confirmed_at, :confirmation_sent_at) }
end
end
user.rb
class User < ActiveRecord::Base
before_create :create_rank
devise :omniauthable, :omniauth_providers => [:facebook]
attr_accessible :provider, :uid
validates :first_name, :last_name, :profile_name, presence: true
# validates :email, presence: true,
# :format => { :with => /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i, :on => :create },
# :uniqueness => true,
#:multiline => true
validates :password, :presence => true,
:confirmation => true,
:length => {:within => 6..40},
:on => :create
validates :password, :confirmation => true,
:length => {:within => 6..40},
:allow_blank => true,
:on => :update
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :registerable, :confirmable
なぜこの問題が発生しているのかよくわかりません。フォームの問題ではないと思いますが、以下のフォームを参照してください。
考案/登録/new.html.erb
div class="span12">
<div class="row">
<div class="span3">
<div class="verticaldivide">
<h2 style="color:white;">Sign up</h2>
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => "form-vertical"}) do |f| %>
<%= f.error_notification %>
<div class="control-group">
<%= f.input :first_name, :required => true, :autofocus => true, label: false, placeholder: "Bilbo", :input_html => {:class => "form-control"} %>
<br />
<%= f.input :last_name, :required => true, :autofocus => true, label: false, placeholder: "Baggins", :input_html => {:class => "form-control"} %>
<br />
<%= f.input :profile_name, :required => true, :autofocus => true, label: false, placeholder: "Bilbo18...", :input_html => {:class => "form-control"} %>
<br />
<%= f.input :email, :required => true, :autofocus => true, label: false, placeholder: "Email please...", :input_html => {:class => "form-control"} %>
<br />
<%= f.input :password, :required => true, label: false, placeholder: "Enter Password", :input_html => {:class => "form-control"} %>
<br />
<%= f.input :password_confirmation, :required => true, label: false, placeholder: "Confirm Password!", :input_html => {:class => "form-control"} %>
<br />
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up", :class => 'btn-primary' %>
</div>
</div>
</div>
<% end %>
<div class="span3">
<h2 style="color:white;">Link Up</h2>
<%= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook) %>
</div>
</div>
ユーザースキーマ:
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 "rank", default: "0"
t.string "first_name"
t.string "last_name"
t.string "profile_name"
t.boolean "admin", default: false
t.integer "sash_id"
t.integer "level", default: 0
t.string "provider"
t.string "uid"
t.string "name"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
end
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end