In RAILS3 - When Creating a Record with 3 columns - how to only accept if all 3 are populated?
I have a model in Rails 3. When creating the record, there are a total of 3 columns for the model.
Right now, Rails allows for creating a record if only 2 of the 3 records are po开发者_运维技巧pulated?
In rails, how do you tell Rails only create a record if 3 values for each column exist when creating?
thank you
class Person < ActiveRecord::Base
validates_presence_of :name, :login, :email
end
http://guides.rubyonrails.org/active_record_validations_callbacks.html#validates_presence_of
精彩评论