From 62d3693288870058f6b963a014ae692f52e805cb Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sat, 17 Mar 2012 20:40:29 -0600 Subject: [getting started] [ci skip] Just want to get post params --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/getting_started.textile') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 8196a67d35..7b457afb23 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -371,7 +371,7 @@ When a form is submitted, the fields of the form are sent to Rails as _parameter def create - render :text => params.inspect + render :text => params[:post].inspect end -- cgit v1.2.3 From b30cc24c40629f38d3de1be972a11eaaa67d20c2 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sat, 17 Mar 2012 20:41:06 -0600 Subject: [getting started] [ci skip] Explain in better terms what we are doing with render and params[:post] inspection upon first use --- guides/source/getting_started.textile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'guides/source/getting_started.textile') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 7b457afb23..4edf772b77 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -375,7 +375,9 @@ def create end -The +render+ method here is taking a very simple hash with the key of +text+ and the value of +params.inspect+. The +params+ method here is the object which represents the parameters (or fields) coming in from the form. If you re-submit the form one more time you'll now no longer get the missing template error. Instead, you'll see something that looks like the following: +The +render+ method here is taking a very simple hash with the key of +text+ and the value of +params[:post].inspect+. The +params+ method here is the object which represents the parameters (or fields) coming in from the form. The +params+ method returns a +HashWithIndifferentAccess+ object, which allows you to access the keys of the hash using either strings or symbols. In this situation, the only parameters that matter are the ones from the form. + +If you re-submit the form one more time you'll now no longer get the missing template error. Instead, you'll see something that looks like the following: {"title"=>"First post!", "text"=>"This is my first post."} -- cgit v1.2.3 From ef0821bef68705e9702f7b0628823cfe591d087e Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sat, 17 Mar 2012 20:41:32 -0600 Subject: [getting started] Explain what the create action is accomplishing after params are output [ci skip] --- guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/getting_started.textile') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 4edf772b77..fdae21caf2 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -383,7 +383,7 @@ If you re-submit the form one more time you'll now no longer get the missing tem {"title"=>"First post!", "text"=>"This is my first post."} - +This action is now displaying the parameters for the post that are coming in from the form. However, this isn't really all that helpful. Yes, you can see the parameters but nothing in particular is being done with them. h4. Running a Migration -- cgit v1.2.3