diff options
author | Oscar Del Ben <info@oscardelben.com> | 2012-04-20 10:43:50 +0200 |
---|---|---|
committer | Oscar Del Ben <info@oscardelben.com> | 2012-04-20 10:43:50 +0200 |
commit | f6d5036dd620da48624ce32494f63aa4221b05d5 (patch) | |
tree | b023a6730c5dffee1a5724d7c026bfa369efeccf /guides/code/getting_started/app/models/post.rb | |
parent | 0d5a7ad84ddbcb4de7c327e39a7747e00b0cd89f (diff) | |
download | rails-f6d5036dd620da48624ce32494f63aa4221b05d5.tar.gz rails-f6d5036dd620da48624ce32494f63aa4221b05d5.tar.bz2 rails-f6d5036dd620da48624ce32494f63aa4221b05d5.zip |
Adapt "Getting started guide" code sample
Diffstat (limited to 'guides/code/getting_started/app/models/post.rb')
-rw-r--r-- | guides/code/getting_started/app/models/post.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/post.rb index 61c2b5ae44..4b809110b6 100644 --- a/guides/code/getting_started/app/models/post.rb +++ b/guides/code/getting_started/app/models/post.rb @@ -1,11 +1,10 @@ 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 |