体验新版 GitCode,发现更多精彩内容 >>
class Post < ActiveRecord::Base validates :title, :presence => true, :length => { :minimum => 5 }
has_many :comments, :dependent => :destroy
accepts_nested_attributes_for :tags, :allow_destroy => :true, :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } } end