开发者

In RAILS3 - When Creating a Record with 3 columns - how to only accept if all 3 are populated?

开发者 https://www.devze.com 2023-01-21 11:08 出处:网络
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开发者_运维技巧pulate

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

0

精彩评论

暂无评论...
验证码 换一张
取 消