I have recently decided to deploy my site test onto my home server using a combination of Ruby on Rails, Passenger (mod_rails)/Apache and Capistrano to deploy. I am trying to render my home page, which at the moment has no database related elements and is all very simple.
The file I'm trying to render is:
<footer>
<nav class="round">
<ul>
<li><%= link_to "About", '#', %></li>
<li><%= link_to "Contact", '#', %></li>
</ul>
</nav>
</footer>
I'm sure its simple syntax or something, but here is the error log part that I believe is important:
Rendered layouts/_footer.html.erb (9.4ms)
Completed 500 Internal Server Error in 276ms
ActionView::Template::Error (/var/rails/releases/20120309031203/app/views/layouts/_footer.html.erb:4: syntax error, unexpected ')'
...pend= ( link_to "About", '#', );@output_buffer.safe_concat('...
... ^
/var/rails/releases/20120309031203/app/views/layouts/_footer.html.erb:5: syntax error, unexpected ')'
...nd= ( link_to "Contact", '#', );@output_buffer.safe_concat('...
... ^
/var/rails/releases/20120309031203/app/views/layouts/_footer.html.erb:10: syntax error, unexpected keyword_ensure, expecting ')'
/var/rails/releases/20120309031203/app/views/layouts/_footer.html.erb:12: syntax error, unexpected keyword_end, expecting ')'):
1: <footer>
2: <nav class="round">
3: <ul>
4: <li><%= link_to "About", '#', %></li>
5: <li><%= link_to "Contact", '#', %></li>
6: </ul>
7: </nav>
app/views/layouts/application.html.erb:16:in `_app_views_layouts_application_html_erb___909272938_79472450'
I hope this is enough, but if you need more, please ask. Thanks.
the root cause is this line of code:
<li><%= link_to "About", '#', %></li>
here, the link_to() method only accept 2 parameters ("about", "#"), however there's a "," in the end. so it got errors.
Also, if you just want to render a link such as:
<a href="#">About</a>
Please use "link_to_function" instead. e.g.
<li><%= link_to_function "About", '#' %></li>