Ruby on rails 3 一个分支中存在Rails 3路由错误,但另一个分支中没有

Ruby on rails 3 一个分支中存在Rails 3路由错误,但另一个分支中没有,ruby-on-rails-3,routes,passenger,Ruby On Rails 3,Routes,Passenger,我使用的是:Rails 3.1.3、HAML和Passenger 我的暂存分支中有一个路由问题,但在合并到暂存中的另一个分支中,我没有任何问题。我尝试使用git diff比较我的路由文件和这两个分支中的表单文件,但是这两个文件在分支中是相同的 奇怪的是呈现错误页面。这里有一个屏幕截图的链接 还有来自乘客的错误: Rendered time_entries/_form_fields.haml (173.2ms) Rendered time_entries/_form.haml (194.7ms)

我使用的是:Rails 3.1.3、HAML和Passenger

我的暂存分支中有一个路由问题,但在合并到暂存中的另一个分支中,我没有任何问题。我尝试使用
git diff
比较我的路由文件和这两个分支中的表单文件,但是这两个文件在分支中是相同的

奇怪的是呈现错误页面。这里有一个屏幕截图的链接

还有来自乘客的错误:

Rendered time_entries/_form_fields.haml (173.2ms)
Rendered time_entries/_form.haml (194.7ms)
Rendered time_entries/edit.haml within layouts/application (196.6ms)
Completed 500 Internal Server Error in 448ms

ActionView::Template::Error (No route matches {:controller=>"time_entries"}):
    5:     .field
    6:       = form.submit "Save"
    7:       |
    8:       = link_to "Cancel", project_time_entries_path(@project)
  app/views/time_entries/_form.haml:8:in `block in     _app_views_time_entries__form_haml__894171410_105032920'
  app/views/time_entries/_form.haml:3:in   `_app_views_time_entries__form_haml__894171410_105032920'
  app/views/time_entries/edit.haml:2:in `_app_views_time_entries_edit_haml__805073897_105087770'
我附上我的路线和表格上的代码

哈姆表格

.app-form
  = error_messages_for :time_entry
  = form_for [@project, @time_entry] do |form|
    = render :partial => 'form_fields', :locals => {:form => form}
    .field
      = form.submit "Save"
      |
      = link_to "Cancel", project_time_entries_path(@project)
routes.rb

Titi::Application.routes.draw do

  root :to => 'time_entries#index'
  match 'home' => 'home#index', :as => :home

  match '/api/*other' => TitiAPI

  resources :projects do
    member do
      get 'archive'
      get 'unarchive'
    end

    resources :viewers
    resources :labels

    resources :time_entries do
      collection do
        get 'start'
      end
      member do
        get 'new_note'
        put 'add_note'
      end
    end

  end

  resources :bookings

  resources :technical_orientations, except: [:delete]

  match 'merge_labels/:projects_id' => 'labels#merge_labels', :as => :merge_labels
  match 'move_labels/:projects_id' => 'labels#move_labels', :as => :move_labels

  resources :time_entries do
    collection do
      get 'start'
    end

    member do
      get 'new_note'
      put 'add_note'
    end
  end

  resources :users do
    member do
      get 'time_entries'
      get 'edit_password'
      put 'update_password'
      get 'suspend'
      get 'unsuspend'
    end

    new do
      get 'invite_form'
      post 'invite'
    end

    collection do
      get 'all'
    end
  end

  resources :user_sessions

  match 'reports/timesheet' => 'reports#timesheet', :as => :timesheet
  match 'reports/:week/timesheet' => 'reports#timesheet', :as => :timesheet_week
  match 'reports/timesheet_detail' => 'reports#timesheet_detail', :as =>     :timesheet_detail
  match 'reports/dashboard' => 'reports#dashboard', :as => :dashboard_report
  match 'reports/timeentries_irregulars' =>    'time_entries_irregulars#timeentries_irregulars', :as => :timeentries_irregulars
  match 'reports/:week/timeirregulars' => 'time_entries_irregulars#timeentries_irregulars', :as => :timeirregulars_week

  match 'reports/timesheet/admin' => 'reports#timesheet_admin', :as => :timesheet_admin
  match 'reports/:week/timesheet/admin' => 'reports#timesheet_admin', :as => :timesheet_admin_week

  match 'reports/time_entries' => 'time_entries_reports#landing_report'
  match 'reports/time_entries/make' => 'time_entries_reports#index'
  match 'reports/time_entries/csv' => 'time_entries_reports#make_csv'

  match 'reports/:token' => 'reports#index', :as => :reports

  match 'login' => 'user_sessions#new', :as => :login
  match 'logout' => 'user_sessions#destroy', :as => :logout
  match 'register' => 'users#register', :as => :register

  resources :companies do
    collection do
      get 'settings'      
      get "remove_photo"
    end
  end  

  match 'labels/for_project_id/:id' => 'labels#for_project_id', :as => :for_project_id

  match 'holidays_for_company/:token' => 'holidays#public', :as => :public_holiday_for_company
  match 'holidays_by_year' => 'holidays#by_year', :as => :holidays_by_year

  resources :holidays 
  resources :clients

  resources :invoices do
    member do
      get 'pdf_invoice'
      get 'cancel'
    end
    resources :invoice_lines do
      collection do
        get 'add'
      end
    end
    resources :payments
  end

  resources :tweets do
    resource :tweet_likes, :path => 'likes' do
      collection do
        get 'names'
      end
    end
  end

  match 'select_invoices' => 'invoices#select_invoices', :as => :select_invoices

  match 'pusher/auth' => 'pusher#auth'

  resources :requests, :only=>[:create]
  match  '*request', :controller => 'requests', :action => 'options', :constraints => {:method => 'OPTIONS', :format => 'json'}
end

提前感谢。

在app/views/time\u entries/\u表单上。haml:8,@project是否存在?也许您的暂存分支使用不同的数据库,因此您认为不存在的@project


另外,运行rake路由并验证项目\时间\条目是否在输出中。也许你需要一个:在你的一条路线上。

它使用相同的数据库,我运行了rake路线,并且路线存在。正如您在my routes.rb中所看到的,路由已定义。很奇怪吧?