Forum: Ruby on Rails Accessing Parameters - Params (nil)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
ryan (Guest)
on 2006-05-02 06:45
I'm trying to render a component that pulls information based on a
parameter that is passed by a link_to item, but my params object is nil
for the following code in the controller:

records = ControllerName.find(params[:id])


but the error page also has this: Parameters: {"id"=>"7"}


I've tried to access it (in the controller) using:

variable = params[:id]

but still nothing.


I'm sure this is basic.  Is there a way to see what params are being
recognized by the controller?

Any help or references are appreciated!
Jean-François (Guest)
on 2006-05-03 21:05
(Received via mailing list)
Hello Ryan,

> variable = params[:id]
>
> but still nothing.
>
> I'm sure this is basic.  Is there a way to see what params are being
> recognized by the controller?

How does your render_component call look like ?

Try to pass the :id argument directly :

render_component(:controller => :my_controller, :action => :my_action,
:id => ...)

Are you using Rails 1.1 ?

HTH,

   -- Jean-François.
This topic is locked and can not be replied to.