# The parameter is nil?

**URL:** <https://www.ruby-forum.com/t/the-parameter-is-nil/125744>\
**Category:** Rails\
**Created:** [January 11, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/the-parameter-is-nil/125744 "2008-01-11T17:26:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![myst\_tt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@myst\_tt](https://www.ruby-forum.com/u/myst_tt)\
**Post date:** [January 11, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/the-parameter-is-nil/125744/1 "2008-01-11T17:26:53Z")

</div>

# Hi, I use scaffold to create the task model controller and view, it contains action as “show”, “new”, “create”, etc. Then, I give an “id” parameters to the view - new.rhtml, so the URL could be like “[http://localhost:3000/tasks/new/1](http://localhost:3000/tasks/new/1)” , and I wish when I click the create button in “new.rhtml”, the following “create” action could get this id parameter, so I coded like this:

def create  
@task = Comment.new(params[:task])

```
respond_to do |format|

       s = params[:id] # I wanna obtain the id

```

parameter here  
puts ‘this is s’ + s  
…  
…

===================

```
However, it gives me the error as :

```

===================  
can’t convert nil into String

# {“commit”=\>“Create”, “authenticity\_token”=\>“ae9620b7a5388f218e783889095d1aa4249cfe30”, “comment”=\>{“author”=\>“222”, “desc”=\>“2”, “img\_url”=\>“2”}}

how can I get the id from “new.rhtml” 's URL and use it in create  
action?

# also attach my new.rhtml

\<% form\_for(@task) do |f| %\>

**Author**  
 \<%= f.text\_field :author %\>

**Desc**  
 \<%= f.text\_area :desc %\>

**Img url**  
 \<%= f.text\_field :img\_url %\>

\<%= f.submit "Create" %\>

\<% end %\>
