I thought I'd spare you the time to google:

http://wiki.merbivore.com/howto/parts

Enjoy!

Pavel Kunc <[email protected]> writes:

> Yes if you need to have some widget or sort of controller with it's
> own views and actions you need to install merb_parts, merb-gen part
> TripList and than you can call the part in this way:
>
> <%= part QuizResultsPart => :most_popular %>
>
> I use parts all over the site to implement Widgets which are small
> pieces of the functionality on the various places of the site. That
> way you don't clutter your controllers or views with data not related
> to the particular controller.
>
> Parts are great for decoupling the dependency.
>
> Cheers
>
> Pavel
>
>
> On Sep 8, 10:49 pm, Yehuda Katz <[email protected]> wrote:
>> Indeed!
>> -- Yehuda
>>
>> On Tue, Sep 8, 2009 at 2:39 PM, Chris Hoeppner 
>> <[email protected]>wrote:
>>
>>
>>
>>
>>
>>
>>
>> > George <[email protected]> writes:
>>
>> > hmmm... Yehuda, please correct me, but aren't "parts" for such things?
>> > Echoes vaguely around the back of my mind.
>>
>> > > yep!
>>
>> > > Partials work well if I put all the trip html into a partial. I just
>> > > hoped there might be a more official way!
>> > > Cheers,
>> > > George
>>
>> > > On Sep 8, 1:22 pm, Chris Hoeppner <[email protected]> wrote:
>> > >> So what you actually want is render the complete controller from within
>> > >> your view?
>>
>> > >> George <[email protected]> writes:
>> > >> > Thanks folks, I new there had to be a simple way.
>> > >> > Thing is that the render "trips/show" needs a context, otherwise merb
>> > >> > says "undefined method `name' for nil:NilClass". We need a way to pass
>> > >> > the trip object or id into the trips/show view.
>>
>> > >> > Here's the code:
>>
>> > >> >     <% client.trips.each do |trip| %>
>> > >> >       <div id="tabClient<%= client.id %>Trip<%= trip.id %>"
>> > class="ui-
>> > >> > tabs-panel">
>>
>> > >> >         <!-- Option 1: Using a partial does work but seems clumsy: -->
>> > >> >         <%#= partial 'trips/tripPage', :trip => trip %>
>>
>> > >> >         <!-- Option 2: This would work if we can pass in the trip
>> > >> > object or id for it to use: -->
>> > >> >         <% render :template => 'trips/show' %>
>>
>> > >> >       </div>
>> > >> >     <% end %>
>>
>> > >> > On Sep 8, 12:46 am, Yehuda Katz <[email protected]> wrote:
>> > >> >> It should :-D
>> > >> >> -- Yehuda
>>
>> > >> >> On Mon, Sep 7, 2009 at 4:32 PM, Chris Hoeppner <
>> > [email protected]>wrote:
>>
>> > >> >> > Yehuda Katz <[email protected]> writes:
>>
>> > >> >> > > You should be able to just do render "template_name" inside the
>> > view.
>>
>> > >> >> > > -- Yehuda
>>
>> > >> >> > > On Mon, Sep 7, 2009 at 8:16 AM, George Adamson <
>> > >> >> > [email protected]
>> > >> >> > >> wrote:
>>
>> > >> >> > >     Hi there,
>>
>> > >> >> > >     I have two classes: client and trip.
>> > >> >> > >     We have "show.html.erb" that displays ok.
>>
>> > >> >> > >     How can I include that content (for a specific trip id)
>> > inside the
>> > >> >> > >     client index page?
>>
>> > >> >> > >     I could do it using a partial that is used in the Trip view
>> > and
>> > >> >> > Client
>> > >> >> > >     view but I rather hoped I could just render the Trip view
>> > from inside
>> > >> >> > >     the Client view.
>>
>> > >> >> > >     Any ideas?
>> > >> >> > >     Many thanks,
>> > >> >> > >     George
>>
>> > >> >> > Would this work with templates in other folders, like
>> > >> >> > render "trips/show" ?
>>
>> > >> >> > --
>> > >> >> > Chris Hoeppner
>>
>> > >> >> > Decir pares, y salir nones, les ocurre a los mamones.
>>
>> > >> >> --
>> > >> >> Yehuda Katz
>> > >> >> Developer | Engine Yard
>> > >> >> (ph) 718.877.1325
>>
>> > >> --
>> > >> Chris Hoeppner
>>
>> > >> Si la pobreza es la madre de los crímenes, la falta de espíritu es su
>> > >> padre.
>> > >>                 -- Jean de la Bruyere. (1645-1696) Escritor francés.
>>
>> > --
>> > Chris Hoeppner
>>
>> > Cuando el mundo corrige un error, normalmente opta por otro peor que el
>> > primero.
>> >                -- Rgela de Henken.
>>
>> --
>> Yehuda Katz
>> Developer | Engine Yard
>> (ph) 718.877.1325
> >

-- 
Chris Hoeppner

Nada pesa tanto como el corazón cuando está cansado.
                -- Juan Zorrilla de San Martín. 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to