Creating a clickable div with 'link_to' syntax

css, html, ruby, ruby-on-rails

Solution

You can do that using the following syntax:

<%= link_to "http://www.facebook.com", id:"item_1" do %>
  #your code here
<% end %>

I hope this is what you were looking for

Problem

I have a clickable div but instead of using the full address for the link, I'd like to use ruby's 'link_to' syntax. How would I point to "facebook_path" instead of the full address? ``` <div id="item_1", onclick="location.href='http://www.facebook.com';" style="cursor:pointer;"> Home </div> ```

Original source