nested-resources

    0熱度

    1回答

    我定義了一個軌道3嵌套的資源如下 resources :candidates do collection do get :bookmarked end resources :bookmarks, :only => [:create, :destroy] end 的candidats集合中的書籤行動將爲候選新書籤。這可以正常工作。 當我嘗試刪除書籤時出現

    2熱度

    1回答

    我無法添加一個斜線slu and和嵌套的路線。 如果我有這些路線: resources :courses do resources :registrations end 我有以下網址: /courses/7 /courses/7/registrations 如果我在Course.rb改變to_param,我可以得到一些蛞蝓的路線發生: def to_param "#

    1熱度

    1回答

    我有一個routes.rb,看起來像這樣: resources :restaurants, :shallow => true do resources :orders do resources :foods end resources :categories do resources :foods end end 這樣的事情在我ab

    1熱度

    2回答

    我使用slu for爲ID,所以想要URL /歌曲/ radiohead/karma-警察而不是/ artists/radiohead/songs/karma-police。 蛞蝓可以實現: def to_param slug end 但是如何,有沒有辦法放棄的型號名稱 - 從標準的REST風格的URL - 「歌」?

    2熱度

    1回答

    我剛開始玩active_admin,我有2個資源: class Category < ActiveRecord::Base validates :name, :presence => true has_many :auctions end 和 class Auction < ActiveRecord::Base belongs_to :category end

    2熱度

    1回答

    當前父控制器我有用戶嵌套資源: resources :users do resources :reservations end 在我的控制器動作,我可以通過使用controller.controller_name得到當前的控制器名。因此,在用戶顯示操作中,controller.controller_name返回「用戶」。同樣,在預訂顯示操作中,它返回「預訂」。 但是當我是一個像「h

    0熱度

    1回答

    好了,所以我的聯想是: Outlet -> has_many :monitorings Monitoring -> belongs_to :outlet 我的路線: resources :outlets do resources :monitorings end 查看: <%= link_to new_outlet_monitoring_path(@outlet) %>

    1熱度

    1回答

    我有一個設計和康康的小項目設置。有用戶,項目,負責任和任務模型。項目嵌套了任務。每個項目分配給一個或多個用戶。任務模型具有名稱user_id和project_id。身份驗證和授權正在按預期工作。 當添加一個新的任務(只有名稱輸入)時,project_id會自動傳遞給model/table(我認爲這是因爲路由),但不是user_id。 我是否必須在hidden_​​field中傳遞user_id或者

    2熱度

    1回答

    的Rails 3.1.0 Rspec的2 在嵌套的資源視圖規範,做我需要實例/存根 父資源之前我存根嵌套資源? 我問這個,因爲我所有的視圖規範是失敗的,因爲我已經在我的應用程序引入了一個新 嵌套的資源。嵌套0​​資源按預期工作 當我手動測試它雖然:( 這裏是我的編輯視圖的規格看起來像 ----- "./spec/views/sub_categories/edit.html.erb_spec.rb"

    3熱度

    1回答

    我有嵌套用於不同的下拉列表中JSON REST應用路線的組合和分組 resources :cities, :only =>[:index,:show] resources :regions, :only =>[:index,:show] do resources :cities, :only=>[:index, :show] end resources :countries, :