# Rendering a partial on a two column page

**URL:** <https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941>\
**Category:** Rails\
**Created:** [May 20, 2010, 9:10pm UTC](https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941 "2010-05-20T21:10:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hazmatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b2d939/32.png) [@hazmatt](https://www.ruby-forum.com/u/hazmatt)\
**Post date:** [May 20, 2010, 9:10pm UTC](https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941/1 "2010-05-20T21:10:12Z")

</div>

Hi,

I attached a page for clarity of what I want.

I have a two column page (index.html.erb). On the left hand side, I have  
the order ID and order NAME displayed. There is a SHOW link next to each  
entry.

I want to be able to click on the SHOW link and have it display the full  
order information on the right hand column (this is the show.html.erb  
file that Rails generated). I turned the default Rails generated  
show.html.erb file into a partial.

I’m sure this has to use link\_to\_remote on the SHOW link, but I’m not  
sure how to make it update the right hand column with the partial. I’ve  
read through a lot of the Rails API info jumping around to Helpers,  
remote\_function and other things. I’m sure I’m missing something simple.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![hazmatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b2d939/32.png) [@hazmatt](https://www.ruby-forum.com/u/hazmatt)\
**Post date:** [May 20, 2010, 11:01pm UTC](https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941/2 "2010-05-20T23:01:59Z")

</div>

Okay, I made a really dumb mistake and put:

\<% javascript\_include\_tag ‘defaults’ %\>

Instead of:

\<% javascript\_include\_tag :defaults %\>

So that fixed my rendering. At least I’m getting information over to the  
other column now. But it’s an error, because it can’t find the ID. I  
attached the screenshot of the error I’m seeing. The following will be  
the code I currently have pertaining to this function. If anyone has any  
ideas on why it’s throwing that error, I would really appreciate it (I  
know I’m missing something small here).

Here is my Show action in the Controller:

def show  
@order = Order.find(params[:id])

```
respond_to do |format|
  format.html # show.html.erb
  format.xml { render :xml => @order }

end

```

end

* * *

Here’s the sections I have in my index.html.erb file:

```
  <% @orders.each do |order| %>
    <tr>
      <td><%=h order.id %></td>
      <td><%=h order.name %></td>
      <td><%= link_to_remote "Show", :url => {:controller => 

```

‘orders’, :action =\> ‘show’}, :update =\> “order\_div”, :method =\> ‘get’  
%\>  
  
\<% end %\>

–

* * *

Here is the info in the \_order\_show.html.erb partial:

**Name:** \<%=h @order.name %\>

**Address:** \<%=h @order.address %\>

**City:** \<%=h @order.city %\>

**State:** \<%=h @order.state %\>

**Zip:** \<%=h @order.zip %\>

…ETC

---

<div class="post-metadata">

**Author:** ![hazmatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b2d939/32.png) [@hazmatt](https://www.ruby-forum.com/u/hazmatt)\
**Post date:** [May 20, 2010, 11:25pm UTC](https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941/3 "2010-05-20T23:25:08Z")

</div>

On May 20, 2010, at 5:01 PM, Matt R. wrote:

> other column now. But it’s an error, because it can’t find the ID. I
> 
> ```
> <% @orders.each do |order| %>
> <tr>
> <td><%=h order.id %></td>
> <td><%=h order.name %></td>
> <td><%= link_to_remote "Show", :url => {:controller =>
> 
> ```
> 
> ‘orders’, :action =\> ‘show’,

:id =\> order.id

> **Address:**  
> \<%=h @order.state %\>  
> [http://www.ruby-forum.com/attachment/4747/ScreenShot004.jpg](http://www.ruby-forum.com/attachment/4747/ScreenShot004.jpg)

But you could also use a named route for the url. Something like  
order\_path(order)

-Rob

Rob B.  
[http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

> **[Launch Scout Custom Software Development & Software Consulting](https://launchscout.com/)**
>
> We solve digital problems through custom software development and design for the web—apps, mobile, desktop and devices.

removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![hazmatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b2d939/32.png) [@hazmatt](https://www.ruby-forum.com/u/hazmatt)\
**Post date:** [May 20, 2010, 11:45pm UTC](https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941/4 "2010-05-20T23:45:33Z")

</div>

Rob B. wrote:

Hi Rob,

Thanks for the quick response!

I’m sorry, I’m still relatively new at this Rails stuff. I have gone  
through a couple of books, but it’s hard to tie it all together. 🙂

When you put the following:

> :id =\> order.id

Where should I enter that? Within the link\_to\_remote somewhere?

Also, I would like to know the following. Not sure where I would enter  
that path in the link\_to\_remote:

> But you could also use a named route for the url. Something like  
> order\_path(order)

Thanks again! I need all the help I can get. 🙂

---

<div class="post-metadata">

**Author:** ![hazmatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b2d939/32.png) [@hazmatt](https://www.ruby-forum.com/u/hazmatt)\
**Post date:** [May 21, 2010, 12:09am UTC](https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941/5 "2010-05-21T00:09:39Z")

</div>

On May 20, 2010, at 5:45 PM, Matt R. wrote:

> > :id =\> order.id
> 
> Where should I enter that? Within the link\_to\_remote somewhere?

Yes, right where I put it:

> ```
> <td><%= link_to_remote "Show", :url => {:controller =>
> 
> ```
> 
> ‘orders’, :action =\> ‘show’,

:id =\> order.id

> }, :update =\> “order\_div”, :method =\> ‘get’  
> %\>

> Also, I would like to know the following. Not sure where I would enter  
> that path in the link\_to\_remote:
> 
> > But you could also use a named route for the url. Something like  
> > order\_path(order)
> 
> Thanks again! I need all the help I can get. 🙂

\<%= link\_to\_remote("Show", :url =\> order\_path(order), :update =\> "order\_div", :method =\> 'get') %\>

-Rob

Rob B.  
[http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

> **[Launch Scout Custom Software Development & Software Consulting](https://launchscout.com/)**
>
> We solve digital problems through custom software development and design for the web—apps, mobile, desktop and devices.

removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![hazmatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b2d939/32.png) [@hazmatt](https://www.ruby-forum.com/u/hazmatt)\
**Post date:** [May 21, 2010, 2:41pm UTC](https://www.ruby-forum.com/t/rendering-a-partial-on-a-two-column-page/188941/6 "2010-05-21T14:41:06Z")

</div>

Thanks Rob!!! It worked PERFECTLY. Thanks again for you help!
