-1
如何验证assosiations验证assosiations轨mongomapper
我有广告belongs_to的城市 ,我需要检查的独特名字的城市我的模型
key :name, String , :required => true ,:unique => true ,:scope => :city_id
key :city_id, ObjectId , :required => true
belongs_to :city
我试图
key :name, String , :required => true ,:unique => true ,:scope => :city_id
的
组块
我错了
+1也代替的属性,你可以使用轨道所需['presence'] (http://guides.rubyonrails.org/active_record_validations.html#presence)助手:) – Mandeep 2014-10-08 16:17:39