Hi, I have a complex bunch of divs and CSS that I''d like to tuck away into a partial. Essentially it''s a box which nests something. So my ideal situation would be if I could render the partial, and then yield out so that my view can add some more content in the middle (again - this is a bunch of HTML that just creates a container for any block object). In this way, I can reuse my partial whenever I need to visually contain a block element. I expected to be able to do this with partials, but after Googling I''m not sure any more, I didn''t find anything very relevant. Thanks for any advice! -- Posted via http://www.ruby-forum.com/.
Hi! I don''t quite understand your problem, but I''m giving it a shot anyway :) Somewhere in an erb template, you can call render :partial => ''foo'' multiple times. If you want to provide different content to your partial, you can supply local variables with :locals => {:foo => bar}. Hope this helps. // Wouter -- Posted via http://www.ruby-forum.com/.
Wouter de Bie wrote:> Hi! > > I don''t quite understand your problem, but I''m giving it a shot anyway > :) > Somewhere in an erb template, you can call render :partial => ''foo'' > multiple times. If you want to provide different content to your > partial, you can supply local variables with :locals => {:foo => bar}. > > Hope this helps. > > // WouterSorry, I realise I wasn''t very clear. As often happens, minutes after seeking help here I managed to find the answer: http://www.pathf.com/blogs/2008/07/pretty-blocks-in-rails-views/ Thanks! -- Posted via http://www.ruby-forum.com/.