模型:
class Project < ActiveRecord::Base
attr_accessible :description, :due_date, :expiration_date, :extra_reward, :hours_needed, :location, :mission, :participants_id, :project_picture, :required_skill, :title, :gnikles, :topic, :community_id
belongs_to :user
belongs_to :community
has_many :skills
validates :title, :presence => true, :length => { :maximum => 100 }
validates :hours_needed, :presence => true, :inclusion => { :in => 0..20 }, :numericality => true
validates :description, :presence => true
validates :required_skill, :presence => true
validates :due_date, :presence => true
#validates :expiration_date, :presence => true
end
试图创建一个测试项目,我得到这个:
1.9.3-p194 :025 > Project.create(:title =>"Testings", :description =>"fdsafdsfsa", :topic => 33, :community_id => 3, :expiration_date => "09/09/2013", :due_date =>"09/28/2013", :hours_needed => 1, :required_skill =>1)
(0.1ms) begin transaction
(0.0ms) rollback transaction
=> #<Project id: nil, title: "Testings", description: "fdsafdsfsa", required_skill: 1, extra_reward: nil, expiration_date: "2013-09-09 00:00:00", due_date: nil, hours_needed: 1, views: nil, user_id: nil, topic: 33, gnikels: 0, completed: 0, created_at: nil, updated_at: nil, community_id: 3>
为什么due_date 不会被传递,但expiration_date 显示没有问题?