From 5acb345a86584e3c9c4b5a81c4499c767393c89a Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Tue, 24 Apr 2012 12:30:24 +0200 Subject: Fix some code in getting started guide --- guides/code/getting_started/app/helpers/home_helper.rb | 2 -- guides/code/getting_started/app/helpers/welcome_helper.rb | 2 ++ guides/source/getting_started.textile | 14 +++++--------- 3 files changed, 7 insertions(+), 11 deletions(-) delete mode 100644 guides/code/getting_started/app/helpers/home_helper.rb create mode 100644 guides/code/getting_started/app/helpers/welcome_helper.rb (limited to 'guides') diff --git a/guides/code/getting_started/app/helpers/home_helper.rb b/guides/code/getting_started/app/helpers/home_helper.rb deleted file mode 100644 index eeead45fc9..0000000000 --- a/guides/code/getting_started/app/helpers/home_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module WelcomeHelper -end diff --git a/guides/code/getting_started/app/helpers/welcome_helper.rb b/guides/code/getting_started/app/helpers/welcome_helper.rb new file mode 100644 index 0000000000..eeead45fc9 --- /dev/null +++ b/guides/code/getting_started/app/helpers/welcome_helper.rb @@ -0,0 +1,2 @@ +module WelcomeHelper +end diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index f184004f80..73f85ab8f9 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -516,7 +516,7 @@ end A couple of things to note. We use +Post.find+ to find the post we're interested in. We also use an instance variable (prefixed by +@+) to -hold our reference to the post object. We do this because Rails will pass all instance +hold a reference to the post object. We do this because Rails will pass all instance variables to the view. Now, create a new file +app/view/posts/show.html.erb+ with the following @@ -577,8 +577,8 @@ end h4. Adding links -You can now create, show, and list posts. But it's difficult to navigate -through pages, so let's add some links. +You can now create, show, and list posts. Now let's add some links to +navigate through pages. Open +app/views/welcome/index.html.erb+ and modify it as follows: @@ -657,11 +657,9 @@ controller by default. TIP: In development mode (which is what you're working in by default), Rails reloads your application with every browser request, so there's no need to stop -and restart the web server. +and restart the web server when a change is made. -Congratulations, you're riding the rails! Now it’s time to see how it all works. - -h4. The Model +h4. Adding Some Validation The model file, +app/models/post.rb+ is about as simple as it can get: @@ -676,8 +674,6 @@ your Rails models for free, including basic database CRUD (Create, Read, Update, Destroy) operations, data validation, as well as sophisticated search support and the ability to relate multiple models to one another. -h4. Adding Some Validation - Rails includes methods to help you validate the data that you send to models. Open the +app/models/post.rb+ file and edit it: -- cgit v1.2.3