Accessing Parameters - Params (nil)


#1

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!


#2

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.