Forum: Ruby on Rails ActionView URL helper problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
James B. (Guest)
on 2009-02-11 22:18
Rails 2.2.2

In the API it says this:

Classes and ids for CSS are easy to produce:

  link_to "Articles", articles_path, :id => "news", :class => "article"
  # => <a href="/articles" class="article" id="news">Articles</a>

In my code I do this:

<%= link_to 'List All Vendors', vendors_path, :id="vendors_index" %>

And Rails does this:

 Showing app/views/entities/index.html.erb where line #108 raised:

compile error
/home/byrnejb/Software/Development/Projects/proforma.git/app/views/entities/index.html.erb:108:
syntax error
@output_buffer.concat(( link_to 'List All Vendors', vendors_path,
:id="vendors_index" ).to_s); @output_buffer.concat "\n"
                                                                       ^

Extracted source (around line #108):

105: <br />
106: <!-- Provide links to list other sub categories of entities -->
107: <%= link_to 'List All Clients', clients_path %>
108: <%= link_to 'List All Vendors', vendors_path, :id="vendors_index"
%>
109: <br />
James B. (Guest)
on 2009-02-11 22:19
James B. wrote:

> Classes and ids for CSS are easy to produce:
>
>   link_to "Articles", articles_path, :id => "news", :class => "article"
>   # => <a href="/articles" class="article" id="news">Articles</a>
>
> In my code I do this:
>
> <%= link_to 'List All Vendors', vendors_path, :id="vendors_index" %>
>

and right after I posted this I saw my error = instead of =>.
This topic is locked and can not be replied to.