mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
11 lines
358 B
Ruby
11 lines
358 B
Ruby
class Post < ActiveRecord::Base
|
|
validates :name, :presence => true
|
|
validates :title, :presence => true,
|
|
:length => { :minimum => 5 }
|
|
|
|
has_many :comments, :dependent => :destroy
|
|
has_many :tags
|
|
|
|
accepts_nested_attributes_for :tags, :allow_destroy => :true,
|
|
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
|
|
end
|