how can i do: render :action => "headline", :id => @user.id Thanks, Ben Lisbakken -- Posted via http://www.ruby-forum.com/.
render :action => ''headline'' does not actually run the headline method. You need to run it explicitly: def other_action @user = User.find(params[:id]) headline render :action => ''headline'' end def headline # you can access @user in here end AFAIK .... but I haven''t done this in a while so things may have changed. -Jonathan. On 7/27/06, Ben Lisbakken <lisbakke@gmail.com> wrote:> how can i do: > render :action => "headline", :id => @user.id > > Thanks, > Ben Lisbakken > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
render :action => "headline", :locals => {:user_id => @user.id}<http://user.id/> and then it will be accessible via :user_id in the partial http://api.rubyonrails.org/classes/ActionController/Base.html#M000206 ed On 7/26/06, Ben Lisbakken <lisbakke@gmail.com> wrote:> > how can i do: > render :action => "headline", :id => @user.id > > Thanks, > Ben Lisbakken > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060727/35ea3608/attachment.html
sorry, that''s user_id, not :user_id (in the partial) On 7/26/06, Ben Lisbakken <lisbakke@gmail.com> wrote:> > how can i do: > render :action => "headline", :id => @user.id > > Thanks, > Ben Lisbakken > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060727/9ba9333b/attachment.html
Bharat Ahluwalia
2006-Jul-27 05:55 UTC
[Rails] RE: can you pass data when you render :action
> Date: Thu, 27 Jul 2006 01:44:58 +0200 > From: Ben Lisbakken <lisbakke@gmail.com> > Subject: [Rails] can you pass data when you render :action > To: rails@lists.rubyonrails.org > Message-ID: <cece5d24da81836e4482ae45a196fbe0@ruby-forum.com> > Content-Type: text/plain; charset=utf-8 > > how can i do: > render :action => "headline", :id => @user.id > > Thanks, > Ben LisbakkenNot sure what you are trying to do, but u can use @user variable itself in the view. Bharat http://blog.publishedperspectives.com