Link_to?

How do I create a hyper link from the restaurant.name value below.

When this list is returned, I want each restaurant name to link to the
show action.

Any help would be appreciated.

Thanks

<% for restaurant in @restaurants %>

<%= h(restaurant.name) %> <%= link_to 'show', :action => 'show', :id => restaurant %>

<% end %>

On Sep 11, 6:12 pm, Craig C. [email protected]
wrote:

How do I create a hyper link from the restaurant.name value below.

<%= link_to restaurant.name, :action => ‘show’, :id => restaurant
%>

Jeff
softiesonrails.com

On 9/11/07, Jeff [email protected] wrote:

On Sep 11, 6:12 pm, Craig C. [email protected]
wrote:

How do I create a hyper link from the restaurant.name value below.

<%= link_to restaurant.name, :action => ‘show’, :id => restaurant
%>

<% = link_to h(restaurant.name), :action => ‘show’, :id => restaurant %>

If you output a db value, be sure to wrap it in h() to prevent XSS and
other nastiness.

Thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs