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(''<Description>''), :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</br> <%= @par %> just somethign else</br> --- 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:> 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(''<Description>''), > :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"] > enddef render_todo_display @par = @params["id"] render :layout => false end You need to set the var before you render ;)> --- > > and this is the .rhtml file: > --- > just somethign</br> > <%= @par %> > just somethign else</br> > --- > > 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? > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org 509-577-7732
Am Mittwoch, den 30.11.2005, 22:23 -0800 schrieb Ezra Zygmuntowicz:> On Nov 30, 2005, at 8:31 PM, Matthew Bonig wrote: > > > 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(''<Description>''), > > :id => ''1'', > > :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(''<Description>''), :update => ''todo_display'', :url => { :action => :render_todo_display, :id => ''1'' }) %>> > > > 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 ;) > > --- > > > > and this is the .rhtml file: > > --- > > just somethign</br> > > <%= @par %> > > just somethign else</br> > > --- > > > > 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? > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > -Ezra Zygmuntowicz > WebMaster > Yakima Herald-Republic Newspaper > ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org > 509-577-7732 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >