0

为什么我的 rails 应用程序会为任何需要路由的操作引发错误?

这是我得到的:

ActionView::Template::Error (undefined local variable or method `href' for #<#<Class:0xaba4f00>:0xafd636c>):

对于任何人link_to,可能有什么问题?,我将 routes.rb 恢复为一个好的版本,但是,我仍然有问题..

任何想法 ?

编辑

这是我的路线.rb

DCACLab2::Application.routes.draw do

  resources :authentications

  resources :class_rooms_member_ships

  resources :lessons

  resources :subscriptions
  resources :plans


  resources :schools




  #match '/:id' => 'class_rooms_member_ships#new', :constraints => { :id => /\d+/ }

  devise_for :users, :controllers => {  :registrations => "users/registrations" } # :sessions => "users/sessions",


  resources :teacher_profiles do
    get :autocomplete_school_name, :on => :collection
  end
  resources :experiments
  get 'experiments/:id/info_edit' => 'experiments#info_edit',:constraints => { :id => /\d+/ }

  Rails.application.routes.draw do


    resources :teacher_profiles

    resources :schools

    filter :locale, :pagination, :uuid
  end


  match 'lang' => 'home#set_lang'

  match 'free_trial' => 'home#free_trial'
  match 'home' => 'home#home'
  match 'features' => 'home#features'
  match 'pricing' => 'home#pricing'

  match 'contact' => 'contact#new', :as => 'contact', :via => :get
  match 'contact' => 'contact#create', :as => 'contact', :via => :post

  match 'dashboard' => 'experiments#index'
  match 'complete_order' => 'home#complete_order'
  post 'notifications' => 'subscriptions#instant_payment_notification'
  get 'paypal/checkout', to: 'subscriptions#paypal_checkout'
  get 'paypal/checkout/post/form', to: 'subscriptions#paypal_checkout_post_form'

  #match 'lab' => 'home#lab'
  match 'lab' => 'experiments#lab'


  match 'trial_account' => 'home#trial_account'
  match 'student_account' => 'home#student_account'
  match 'school_account' => 'home#school_account'


  match 'create_account' => 'home#registration_entrance'
  match 'users/create_account' => 'home#registration_entrance'
  match 'registration_redirect' => 'home#registration_redirect', :via=>[:post]
  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  root :to => 'home#home'

  match '/auth/facebook/logout' => 'authentications#facebook_logout', :as => :facebook_logout
  #match '/auth/facebook/callback' => 'authentications#create'
  match '/auth/:provider/callback' => 'authentications#create'
  match '/auth/failure' => 'authentications#failure'

  match '/fb_channel', :controller=>'authentications', :action=>'fb_channel'


end

至于link_to代码,它只是正常的..

%li{:class=>"#{action_name == action ? 'active':''}"}
                 = link_to :controller => '/home', :action => action do
                   = t(action)
4

0 回答 0