Ruby on rails “No route matches”

后端 未结 5 1869
北荒
北荒 2021-02-20 09:06

I am new to Rails and am just implementing some basic applications. Just starting on my second app and have run into what is a basic problem, but Google is yielding me nothing.

相关标签:
5条回答
  • 2021-02-20 09:34

    You need to add admin_login method to routes, like:-

    map.connect '/user/admin_login', :controller => 'users', :action => 'admin_login'
    
    0 讨论(0)
  • 2021-02-20 09:39

    For Rails > 3 you should use the new routing syntax:

    resources :items, :cart
    
    resource :user do
      # Route GET /user/admin_login
      get 'admin_login', :on => :collection
    end
    

    See Rails guides for more information about routing.

    0 讨论(0)
  • 2021-02-20 09:45

    you can use

    match 'admin_login' => 'user#admin_login', :as =>'admin_login'
    

    default method for this call is post u can change method behavior by using

    :via => [:post/:put/:get]
    
    0 讨论(0)
  • 2021-02-20 09:46

    There is a new method in Rails 3. You can use the following:

    get 'admin_login' => "user#admin_login"
    
    0 讨论(0)
  • 2021-02-20 09:47

    find “config/routes.rb” file, edit, Locate the following line:

    # See how all your routes lay out with "rake routes"
    

    In this line add the following line, as follows:

    map.connect '',:controller=>"index",:action=>"index"
    
    0 讨论(0)
提交回复
热议问题