我是新來的Rails,現在學習路由,這是我在我的routes.rb
:Rails的路由:錯了路
match '/text' => 'text#index'
match '/text/:id' => 'text#show'
這是我的app/views/text/index.html.erb
:
<h1>Texts</h1>
<% @texts.each do |t| %>
<div><%= link_to t.title, text_path(t) %></div>
<% end %>
的問題是,當我點擊鏈接時,它會將我重定向到'/text.1'而不是'/ text/1'。任何人都可以弄清楚爲什麼?
謝謝。