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