rails-routing

    0熱度

    2回答

    我正在關注來自railstutorial.org的Michael Hartl的Screencast。根據第5章,我改變 配置/ routes.rb中於: SampleApp::Application.routes.draw do match '/contact', :to => 'pages#contact' match '/about', :to => 'pages#abou

    0熱度

    1回答

    我正在使用RSpec-2來測試我的控制器,並且看到奇怪的行爲。 基本上我在Railscasts #71 describe DeliverablesController do describe "responding to POST create" do describe "with valid parameters" do it "should pass the p

    2熱度

    1回答

    我試圖實現基本的社交網絡功能,以允許用戶添加,刪除朋友,接受和拒絕friedship請求。 我的用戶資源是這樣的: resources :users resources :friends, :controller => :relations end 產生這條路線user_friend DELETE /users/:user_id/friends/:id 但問題是,當我訪問/user

    2熱度

    1回答

    首先,我在配置/ route.rb get 'inbox/index' => 'inbox#index' 然後我跑了rake routes這條路線,是正確生成路線: inbox_index GET /inbox/index(.:format) {:action=>"index", :controller=>"inbox"} 問題是,當我試圖從瀏覽器中獲取頁面(http:// localho

    0熱度

    1回答

    這可能很簡單,但我無法弄清楚。 我試圖創建一個路由:提交#通過URL新「/提交」 resources :submissions, :only => [:index, :show, :new, :create] match 'submit', :to => 'submissions#new' 上面的代碼工作正常,但我想阻止創建的URL標準的「資源」 「/ submission/new」,只使用

    0熱度

    1回答

    我想在rails中實現一個被遺忘的密碼解決方案。我有一個表格供用戶輸入他們註冊帳戶的電子郵件地址,我打算讓郵件程序給他們發送一封唯一的URL,將他們鏈接到密碼重置頁面。 我的config/routes.rb中文件有以下途徑: resources :users do collection do get :lost_password #the account-email submi

    0熱度

    3回答

    ,我有以下嵌套的資源在我routes.rb文件 ​​ 我的模型: class Issuer < ActiveRecord::Base has_many :certificates end class Certificate < ActiveRecord::Base belongs_to :issuer end 我得到當我訪問以下錯誤:/issuer/2/certif

    4熱度

    1回答

    我在routes.rb中,看起來像這樣的條目: resources :baskets, :shallow => true, :only => :show resource :owned, :only => [:create, :destroy] end get '/baskets/owned', :to => 'owners#index' 這將創建一個看起來像路線: baske

    2熱度

    1回答

    這是一個非常奇怪的問題,不幸的是我不能提供大量信息,因爲我甚至不知道從哪裏開始診斷問題。我希望有人聽到神奇的知道該怎麼做,我很樂意澄清必要的。 由於某種原因,我隨時使用Chrome在Heroku上提交一個帶有文件附件的新的多部分表單,我會在提交給默認的「索引」操作時發送 - 也就是我將發送到的頁面如果我提交了GET而不是POST。 我使用Rails的標準REST風格的路線,所以在我的routes.

    2熱度

    1回答

    對於我目前的路由,在軌道上的代碼如下紅寶石: <%= link_to current_user.name, users_path(current_user) %> 產生一個鏈接像下面這樣: <a href="/users.1">name</a> 反過來,Ruby on Rails的有一個很難理解這個,因爲它預計1是格式: ActiveRecord::RecordNotFound in Us