From f6d5036dd620da48624ce32494f63aa4221b05d5 Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Fri, 20 Apr 2012 10:43:50 +0200 Subject: Adapt "Getting started guide" code sample --- guides/code/getting_started/app/models/post.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'guides/code/getting_started/app/models') 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 -- cgit v1.2.3 From dbb4c4ddb601e06fef37f63d644a5297f3292c2a Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Fri, 20 Apr 2012 10:47:38 +0200 Subject: New Getting started guide wont have tags --- guides/code/getting_started/app/models/post.rb | 1 - guides/code/getting_started/app/models/tag.rb | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 guides/code/getting_started/app/models/tag.rb (limited to 'guides/code/getting_started/app/models') diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/post.rb index 4b809110b6..e77e607f3f 100644 --- a/guides/code/getting_started/app/models/post.rb +++ b/guides/code/getting_started/app/models/post.rb @@ -3,7 +3,6 @@ class Post < ActiveRecord::Base :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? } } diff --git a/guides/code/getting_started/app/models/tag.rb b/guides/code/getting_started/app/models/tag.rb deleted file mode 100644 index 30992e8ba9..0000000000 --- a/guides/code/getting_started/app/models/tag.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Tag < ActiveRecord::Base - belongs_to :post -end -- cgit v1.2.3 From 2e2afc0ac64190261df4b05428afddea96c8628c Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Fri, 20 Apr 2012 12:06:47 +0200 Subject: Add show action in getting started guide --- guides/code/getting_started/app/models/post.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'guides/code/getting_started/app/models') diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/post.rb index e77e607f3f..21387340b0 100644 --- a/guides/code/getting_started/app/models/post.rb +++ b/guides/code/getting_started/app/models/post.rb @@ -3,7 +3,4 @@ class Post < ActiveRecord::Base :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 -- cgit v1.2.3