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. 

--~--~---------~--~----~------------~-------~--~----~
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