开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜