5
我想在索引页面中创建超链接,但它不显示,也不会给出任何错误。以下是我的index.html.erb代码。link_to没有显示任何栏杆
<h1> Listing articles </h1>
<% link_to 'New article', new_article_path %> <---- Everything works perfectly except this doesnt show anything
<table>
<tr>
<th>Title</th>
<th>Textssss</th>
<tr>
<% @articles.each do |article| %>
<tr>
<td><%= article.title %> </td>
<td><%= article.text %> </td>
</tr>
<% end %>
</table>
我检查过我的路线,我认为他们也没关系。
Prefix Verb URI Pattern Controller#Action
welcome_index GET /welcome/index(.:format) welcome#index
articles GET /articles(.:format) articles#index
POST /articles(.:format) articles#create
new_article GET /articles/new(.:format) articles#new
edit_article GET /articles/:id/edit(.:format) articles#edit
article GET /articles/:id(.:format) articles#show
PATCH /articles/:id(.:format) articles#update
PUT /articles/:id(.:format) articles#update
DELETE /articles/:id(.:format) articles#destroy
root GET / welcome#index
我可以手动从本地主机访问文章/新,但我不认为这就是问题所在。 任何帮助表示赞赏..
将'='添加到'link_to'。 '<%= link_to'新文章',new_article_path%>'并阅读了关于['ERB'](http://stackoverflow.com/questions/3952403/without-equal-in-ruby-erb-means) – 2014-12-07 16:25:44
Thanks dude那清理了很多东西.. – soldiershin 2014-12-07 16:33:20