The parameter is nil?

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” , 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 =[: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


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

also attach my new.rhtml

<% form_for(@task) do |f| %>

<%= f.text_field :author %>

<%= f.text_area :desc %>

Img url
<%= f.text_field :img_url %>

<%= f.submit "Create" %>

<% end %>