# Nil object while the required parameter are in the request

**URL:** <https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682>\
**Category:** Rails\
**Created:** [January 11, 2007, 9:23am UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682 "2007-01-11T09:23:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 11, 2007, 9:23am UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682/1 "2007-01-11T09:23:59Z")

</div>

I’m having an application as follows.  
I have all the parameters for as object appended in the url.  
And there is an action in the controller like this

def newlet  
render :layout=\> false  
@product = Product.new

if request.get?  
@product.title= params[:title]  
@product.description = params[:description]  
@product.primary\_link = params[:primary\_link]  
@product.image\_url1 = params[:image\_url1]  
@product.primary\_price = params[:primary\_price]

end  
end

And the url looks like  
[http://example.com/controllername/newlet?title=aaaa&description=bbbb&primary\_link=cccc&image\_url=dddd&primary\_price=1220](http://example.com/controllername/newlet?title=aaaa&description=bbbb&primary_link=cccc&image_url=dddd&primary_price=1220)

And the corresponding view

 ï»¿

Title

Primary link

Description

Image url1

Primary price

But the error message

NoMethodError in Admin#newlet

Showing app/views/admin/\_autoform.rhtml where line #8 raised:

You have a nil object when you didn’t expect it!  
The error occured while evaluating nil.title

Extracted source (around line #8):

5:  
6:   
7:

Title  
  
8:

  
9:  
10: 

Primary link  
  
11:

Trace of template inclusion: /app/views/admin/newlet.rhtml

RAILS\_ROOT: C:/INSTAN~1/rails\_apps/test/config/…  
Application Trace | Framework Trace | Full Trace

#{RAILS\_ROOT}/app/views/admin/\_autoform.rhtml:8:in  
`_run_rhtml_admin__autoform' #{RAILS_ROOT}/app/views/admin/newlet.rhtml:5:in `\_run\_rhtml\_admin\_newlet’  
#{RAILS\_ROOT}/app/controllers/admin\_controller.rb:37:in `newlet’

C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:316:in  
`send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile\_and\_render\_template’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:292:in  
`render_template' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render\_file’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:266:in  
`render' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:59:in `render\_partial’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:29:in  
`benchmark' C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’  
C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:307:in `realtime' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:29:in `benchmark’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/partials.rb:58:in  
`render_partial' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:278:in `render’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:316:in  
`send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile\_and\_render\_template’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:292:in  
`render_template' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render\_file’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:726:in  
`render_file' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:695:in `render\_with\_no\_layout’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/layout.rb:253:in  
`render_without_benchmark' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’  
C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:941:in  
`send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform\_action\_without\_filters’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/filters.rb:368:in  
`perform_action_without_benchmark' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform\_action\_without\_rescue’  
C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform\_action\_without\_rescue’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/rescue.rb:82:in  
`perform_action' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:408:in  
`process_without_filters' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process\_without\_session\_management\_support’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/session\_management.rb:117:in  
`process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:in  
`process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in `process\_client’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in  
`each' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in `process\_client’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in  
`run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `initialize’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in  
`new' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `run’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in  
`initialize' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `new’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in  
`run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in `run’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in  
`each' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in `run’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel\_rails:127:in  
`run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in `run’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel\_rails:235  
C:/INSTAN~1/ruby/bin/mongrel\_rails:18:in `load’  
C:/INSTAN~1/ruby/bin/mongrel\_rails:18

#{RAILS\_ROOT}/app/views/admin/\_autoform.rhtml:8:in  
`_run_rhtml_admin__autoform' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `send’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:316:in  
`compile_and_render_template' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render\_template’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:251:in  
`render_file' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:266:in `render’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/partials.rb:59:in  
`render_partial' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:29:in `benchmark’  
C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:307:in `realtime’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:29:in  
`benchmark' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:58:in `render\_partial’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:278:in  
`render' #{RAILS_ROOT}/app/views/admin/newlet.rhtml:5:in `\_run\_rhtml\_admin\_newlet’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:316:in  
`send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile\_and\_render\_template’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_view/base.rb:292:in  
`render_template' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render\_file’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:726:in  
`render_file' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:695:in `render\_with\_no\_layout’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/layout.rb:253:in  
`render_without_benchmark' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’  
C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’  
#{RAILS\_ROOT}/app/controllers/admin\_controller.rb:37:in `newlet' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `send’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:941:in  
`perform_action_without_filters' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform\_action\_without\_benchmark’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform\_action’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/base.rb:408:in  
`send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process\_without\_filters’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/filters.rb:377:in  
`process_without_session_management_support' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in  
`dispatch' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:in `process’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in  
`process_client' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in `each’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in  
`process_client' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `run’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in  
`initialize' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `new’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in  
`run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `initialize’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in  
`new' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `run’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in  
`run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in `each’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in  
`run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:127:in `run’  
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in  
`run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235 C:/INSTAN~1/ruby/bin/mongrel_rails:18:in `load’  
C:/INSTAN~1/ruby/bin/mongrel\_rails:18

Request

Parameters: {“title”=\>“Yatego\_Merino\_Soft\_Stringbody.jpg (JPEG  
\345\234\226\347\211\207\357\274\214400x527 \345\203\217\347\264\240)”,  
“primary\_link”=\>“[http://www9.yatego.com/images/450121e567d499.5/Yatego\_Merino\_Soft\_Stringbody.jpg](http://www9.yatego.com/images/450121e567d499.5/Yatego_Merino_Soft_Stringbody.jpg)”,  
“primary\_price”=\>“2000”, “description”=\>“hlghghkgf”,  
“image\_url1”=\>“[http://www9.yatego.com/images/450121e567d499.5/Yatego\_Merino\_Soft\_Stringbody.jpg](http://www9.yatego.com/images/450121e567d499.5/Yatego_Merino_Soft_Stringbody.jpg)”}

I can see the request contains all the parameter needed.  
And I’ve also validated each parameter.  
No idea what could go wrong with this.

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 11, 2007, 10:32am UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682/2 "2007-01-11T10:32:08Z")

</div>

Stephan W. wrote:

> Bontina C. wrote:
> 
> > I’m having an application as follows.  
> > I have all the parameters for as object appended in the url.  
> > And there is an action in the controller like this
> > 
> > def newlet
> 
> # Move this line to the end of method newlet
> 
> > ```
> > render :layout=> false
> > @product = Product.new
> > 
> > ```
> > 
> > if request.get?  
> > @product.title= params[:title]  
> > @product.description = params[:description]  
> > @product.primary\_link = params[:primary\_link]  
> > @product.image\_url1 = params[:image\_url1]  
> > @product.primary\_price = params[:primary\_price]
> > 
> > end
> 
> # Here
> 
> ```
> render :layout=> false
> 
> ```
> 
> > end
> 
> Stephan

It works!!! THANKS A LOT  
But I have two create button at the bottom.  
When I remove   
They are all gone.  
I suppose there should be one left.

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 11, 2007, 10:04am UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682/3 "2007-01-11T10:04:28Z")

</div>

Bontina C. wrote:

> I’m having an application as follows.  
> I have all the parameters for as object appended in the url.  
> And there is an action in the controller like this
> 
> def newlet

# Move this line to the end of method newlet

> ```
> render :layout=> false
> @product = Product.new
> 
> ```
> 
> if request.get?  
> @product.title= params[:title]  
> @product.description = params[:description]  
> @product.primary\_link = params[:primary\_link]  
> @product.image\_url1 = params[:image\_url1]  
> @product.primary\_price = params[:primary\_price]
> 
> end

# Here

```
 render :layout=> false

```

> end

Stephan

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 11, 2007, 10:47am UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682/4 "2007-01-11T10:47:27Z")

</div>

> But I have two create button at the bottom.  
> When I remove

Just to make sure, the create buttons both say “Create” ?

Try changing the one “Create” that you see to “Create2” and see what  
happens.

I don’t recall the Windows equivalent of grep, this might help too:

grep Create app/_/_ app/_/_/\*

Also it seems you should be using method=“POST”, not “GET” for your  
form.  
See also

[http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost](http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost)

about redirecting in response to POSTs.

Stephan

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 11, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682/5 "2007-01-11T13:58:45Z")

</div>

Stephan W. wrote:

> > But I have two create button at the bottom.  
> > When I remove
> 
> Just to make sure, the create buttons both say “Create” ?
> 
> Try changing the one “Create” that you see to “Create2” and see what  
> happens.
> 
> I don’t recall the Windows equivalent of grep, this might help too:
> 
> grep Create app/_/_ app/_/_/\*
> 
> Also it seems you should be using method=“POST”, not “GET” for your  
> form.  
> See also
> 
> [News, Analysis and Opinion for TheServerSide - TheServerSide.com](http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost)
> 
> about redirecting in response to POSTs.
> 
> Stephan

Thanks for the reference. I’m doing this in two stages. I use get to  
fill data in the form column. And post when user makes sure this is what  
the want to summit.  
I figured out the difference of the two create button.  
Only one of them is really functioning.

this one

But I found the data in the @product are all flushed out through this  
action.

def create

```
@product = Product

```

@product.user\_id = session[:user\_id]  
@product.created\_at = Time.now

if @product.save  
flash[:notice] = ‘Product was successfully created.’  
redirect\_to :action =\> ‘list’

```
else
  render :action => 'new'

end

```

end

Anything I can do to keep the data?

Many thanks

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 12, 2007, 2:29am UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682/6 "2007-01-12T02:29:53Z")

</div>

That’s a mis-paste sorry.  
I fixed the problem.  
Thank you so much for all the help.

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 11, 2007, 5:01pm UTC](https://www.ruby-forum.com/t/nil-object-while-the-required-parameter-are-in-the-request/81682/7 "2007-01-11T17:01:21Z")

</div>

> But I found the data in the @product are all flushed out through this  
> action.
> 
> def create

# You seem to mean

```
 @product = Product.new(params[:product])

```

# instead of just Product.

> ```
> @product = Product
> 
> ```
> 
> @product.user\_id = session[:user\_id]  
> @product.created\_at = Time.now
> 
> if @product.save  
> flash[:notice] = ‘Product was successfully created.’  
> redirect\_to :action =\> ‘list’
> 
> ```
> else
> render :action => 'new'
> 
> end
> 
> ```
> 
> end
> 
> Anything I can do to keep the data?
> 
> Many thanks
