1
저는 Rails 3.2.11, mongoid 3.1.2 및 2.2.3을 사용하고 있으며 birtday Date 필드가있는 User 모델이 있습니다. Rails + Mongoid + Devise : 등록 양식에 생일 필드를 추가하십시오.
class User
include Mongoid::Document
field :birthday, type: Date
field :email, type: String, default: ""
field :encrypted_password, type: String, default: ""
field :remember_created_at, type: Time
attr_accessible :email, :password, :password_confirmation, :remember_me, :birthday
devise :database_authenticatable, :registerable, :rememberable, :validatable
validates_presence_of :email, :birthday
...
end
나는 다음과 같이 등록 양식에
생일 필드를 추가 : 생일은 비워 둘 수 없습니다 :
f.input :birthday, :as => :date, :start_year => (Date.current - 5.year).year, :end_year => (Date.current - 120.year).year, :include_blank => true
문제는 내가 항상 오류가 등록 할 때이다. 나는 로그를 볼 때
내가 볼 : 그것은 어떤 기회없이 내가 시간이 인터넷 검색을했습니다 :( 를 작동하지 않는 이유
그래서Started POST "/users" for 127.0.0.1 at 2013-04-22 13:58:27 +0200
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Cmjq47KqHWzEoytGxH+L5s5zbWrHYDZn221Dq6+wVQQ=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "birthday(3i)"=>"25", "birthday(2i)"=>"11", "birthday(1i)"=>"1984"}
내가 볼 수없는 나는 그것에서 온 수 있지만. mongoid의 대량 assignement 또는 build_ressource을 고안하지만 난 어떤 해결책을 찾을 수 없습니다 당신은 이미이 문제를받을 수 있나요
T 너를 너무 많이 행크해라 !! 그것은 매력처럼 작동합니다. 그들은 "이유"에 덧붙여야만합니다. 예를 들자면 보석과 같은 보석이 필요합니다 !! http://mongoid.org/en/mongoid/docs/rails.html – XPac27