Why isn't this working?

Ok, so I know this is a totally obvious question, but it’s dumbfounding
me
right now. I’ve got Ruby on Rails going and I know this has worked
before…

I have a html fragment that does:

<%= link_to_remote (h(’’),
:id => ‘1’,
:update => ‘todo_display’,
:url => { :action => :render_todo_display }) %>

This is the code in the same controller:

def render_todo_display
render(:layout => false)
@par = @params[“id”]
end

and this is the .rhtml file:

just somethign
<%= @par %>
just somethign else

But when I click on the link in the html fragment, the correct section
gets
updated with just this:

just somethign
just somethign else

I’ve tried:
@par = params[:id]

that didn’t work. I know this is totally easy, but what the heck is
wrong?

On Nov 30, 2005, at 8:31 PM, Matthew Bonig wrote:


This is the code in the same controller:

def render_todo_display
render(:layout => false)
@par = @params[“id”]
end
def render_todo_display
@par = @params[“id”]
render :layout => false
end

You need to set the var before you render :wink:

section gets updated with just this:


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
[email protected]
509-577-7732

Am Mittwoch, den 30.11.2005, 22:23 -0800 schrieb Ezra Z.:

  				:update => 'todo_display',
  				:url => { :action => :render_todo_display }) %>

You have also to put the :id key into the :url hash if you want to
retrieve it in your controller action.

<%= link_to_remote (h(’’),
:update => ‘todo_display’,
:url => { :action => :render_todo_display, :id => ‘1’ }) %>