I have a chunk of rhtml that gets reused by several views in several controllers. I make partial out of it _foo and call it with <%= render :partial =>''bar/foo'' %> # RAILS_ROOT/app/views/bar/_foo.rhtml (note I''m not calling with a collection.) Is there a way to send a variable to the partial? the doc says i can use :locals => { :name => ''val'' } but what I want to do is alias :name to another variable. I can always set some class variable @var and using that inside the partial, but I want to make it explicit what it is that I''m passing to the partial. also, is this the way to share something among views? I''m aware of layouts but that seems to be for whole page content, rather than common snippets. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 13, 2007, at 7:52 AM, rubynuby wrote:> I have a chunk of rhtml that gets reused by several views in several > controllers. I make partial out of it _foo and call it with > > <%= render :partial =>''bar/foo'' %> > > # RAILS_ROOT/app/views/bar/_foo.rhtml > > (note I''m not calling with a collection.) Is there a way to send a > variable to the partial? the doc says i can use :locals => { :name => > ''val'' } but what I want to do is alias :name to another variable. I > can always set some class variable @var and using that inside the > partial, but I want to make it explicit what it is that I''m passing to > the partial. > > also, is this the way to share something among views? I''m aware of > layouts but that seems to be for whole page content, rather than > common snippets.Have a look at the methods discussed in this article, http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/ -- def gw acts_as_n00b writes_at(www.railsdev.ws) end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 13, 2007, at 10:30 AM, Greg Willits wrote:> Have a look at the methods discussed in this article, > http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/ > > -- > def gw > acts_as_n00b > writes_at(www.railsdev.ws) > end > >As usual, you''re on the ball Greg. I was thinking about that very resource, but couldn''t remember where I saw it. Peace, Phillip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 13 Dec 2007, at 18:15, Phillip Koebbe wrote:> > On Dec 13, 2007, at 10:30 AM, Greg Willits wrote: > >> Have a look at the methods discussed in this article, >> http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/ >> >> -- >> def gw >> acts_as_n00b >> writes_at(www.railsdev.ws) >> end >> >> > > As usual, you''re on the ball Greg. I was thinking about that very > resource, but couldn''t remember where I saw it. >Well it would be surprising if he''d forgotton something he''d written himself :-) Fred> Peace, > Phillip > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 13, 2007, at 12:52 PM, Frederick Cheung wrote:> > > On 13 Dec 2007, at 18:15, Phillip Koebbe wrote: > >> >> On Dec 13, 2007, at 10:30 AM, Greg Willits wrote: >> >>> Have a look at the methods discussed in this article, >>> http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/ >>> >>> -- >>> def gw >>> acts_as_n00b >>> writes_at(www.railsdev.ws) >>> end >>> >>> >> >> As usual, you''re on the ball Greg. I was thinking about that very >> resource, but couldn''t remember where I saw it. >> > Well it would be surprising if he''d forgotton something he''d written > himself :-) > > Fred >>Aye, and you are on the ball, too, Fred. :) Peace, Phillip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thank you. excellent article. an O/T question. what is the font used in the pdf for the code portion? it''s a nice fixed monospace font and I''m always on the lookout for good monospace fonts to use for coding :) Currently I use Lucida Console but it has a problem in that commas and periods look too much alike. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 13, 2007, at 10:52 AM, Frederick Cheung wrote:> On 13 Dec 2007, at 18:15, Phillip Koebbe wrote: >> On Dec 13, 2007, at 10:30 AM, Greg Willits wrote: >> >>> Have a look at the methods discussed in this article, >>> http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/ >> >> As usual, you''re on the ball Greg. I was thinking about that very >> resource, but couldn''t remember where I saw it. > > Well it would be surprising if he''d forgotton something he''d written > himself :-)Well, given that I tend to write such things at the moment I reach my epiphany about the topic, I can very easily forget what I write :-) I''ve been pointed to my own advice more than once :-P -- def gw acts_as_n00b writes_at(www.railsdev.ws) end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 13, 2007, at 2:13 PM, rubynuby wrote:> an O/T question. what is the font used in the pdf for the code > portion?That would be Monaco (default monospaced font on a Mac) -- gw --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---