Ruby on rails 使用点创建格式错误的路线的轨道

Ruby on rails 使用点创建格式错误的路线的轨道,ruby-on-rails,routing,Ruby On Rails,Routing,我使用path helper方法在link_to中生成URL,它们返回的URL格式如下: http://localhost:3000/tweets.4 当我期待他们像这样形成的时候: http://localhost:3000/tweets/4 请注意它是如何使用点作为分隔符,而不是预期的正斜杠。顶部链接不能解析为正确的视图,它只是重新加载/tweets视图。当我手动编辑URL使其与底部类似时,它会打开正确的/tweets/show/ 我在网上研究中发现的最接近的一件事是,人们遇到了错误嵌套

我使用path helper方法在link_to中生成URL,它们返回的URL格式如下:

http://localhost:3000/tweets.4
当我期待他们像这样形成的时候:

http://localhost:3000/tweets/4
请注意它是如何使用点作为分隔符,而不是预期的正斜杠。顶部链接不能解析为正确的视图,它只是重新加载/tweets视图。当我手动编辑URL使其与底部类似时,它会打开正确的/tweets/show/

我在网上研究中发现的最接近的一件事是,人们遇到了错误嵌套的路由语句——但我不认为我在这里这样做

我将感谢任何人能提供的任何帮助或指点

以下是相关的源文件和版本信息:

tweets/index.html.erb

<h1>Listing tweets</h1>

<% @tweets.each do |tweet| %>
<div>
    <!-- creates path in format of /tweets.2 -->
    <div><%= link_to tweet.status, tweets_path(tweet) %></div>

    <!-- creates path in the format of /user.1 -->
    <div><%= link_to tweet.user.name, users_path(tweet.user) %></div>   
</div>
<% end %>
class TweetsController < ApplicationController

  def index
    @tweets = Tweet.all
  end

  def show
    @tweet = Tweet.find(params[:id])
  end

  def new
    @tweet = Tweet.new
  end

  def create
    @tweet = Tweet.new(params[:tweet])
    @tweet.user = User.last

    if(@tweet.save)
      redirect_to :root
    end  
  end

  def edit
    @tweet = Tweet.find(params[:id])
  end

  def delete
  end

end
Zombietweets::Application.routes.draw do
  resources :tweets
  root :to => 'tweets#index'
end  
Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.9'

group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
end

group :assets do
  gem 'sass-rails',   '3.2.3'
  gem 'coffee-rails', '3.2.1'
  gem 'uglifier', '1.0.3'
end

gem 'jquery-rails', '2.0.2'

我使用的是Rails 3.2.9和Ruby 1.9.3p327(2012-11-10)[x86\u 64-darwin12.2.0]

你试过
tweet\u path
user\u path

您想访问“显示操作”。对于该操作,模型名称在*\u路径调用中必须是单数

当然,可以在控制台中尝试使用
rake routes

编辑:
您还忘了在路由文件中添加
resources:users

谢谢!我很难为情地提到我花了多长时间试图弄明白这一点:)重复的