nested-resources

    106熱度

    3回答

    我有一個關於form_for和嵌套資源的兩部分問題。假設我正在編寫一個博客引擎,我想將評論與一篇文章聯繫起來。我如下界定的巢資源: map.resources :articles do |articles| articles.resources :comments end 評論表單是在文章show.html.erb觀點,文章本身的下方,比如像這樣: <%= render :part

    12熱度

    4回答

    想象一下,你有兩個定義路線: map.resources articles map.resources categories, :has_many => :articles 都可以訪問由助手/路徑 articles_path # /articles category_articles_path(1) # /category/1/articles ,如果你訪問/articles,inde

    2熱度

    1回答

    我在我的應用程序中有一些標準的嵌套路線,我想使用subdomain-fu寶石實現子域。所以我目前做的: example.com/stores/name_of_store/products/name_of_product ,我想這樣做: name_of_store.example.com/products/name_of_product 似乎已經大約子域復的失敗一些討論關於嵌套路線subdo

    1熱度

    3回答

    這裏的routes.rb中: map.resources :assignments, :shallow => true do |assignment| assignment.resources :problems end 我如何獲得url編輯問題(/任務/ XYZ /問題/ ABC /編輯),在代碼中?我已經嘗試了 edit_assignment_problem_path(作業,問

    0熱度

    3回答

    如routes.rb中所指定的,是否可以自動將指定的佈局模板分配給特定的控制器以及嵌套在其中的所有資源?此佈局應該只應用指定的控制器視圖和嵌套在其中的那些視圖;它不需要應用於應用程序中的每個視圖,就像application.html.erb會(我實際上使用具有嵌套佈局的應用程序佈局的專用佈局)。 因此,舉例來說,如果我有 map.resources :news, :shallow => true

    4熱度

    3回答

    什麼是你的問題的解決方案,如果您有兩個未嵌套和嵌套的模型,如產品: 「產品」可以belong_to說的「事件「,而產品也可以是獨立的。 這意味着我能有這樣的路線: map.resources :products # /products map.resources :events do |event| event.resources :products # /events/1/produ

    1熱度

    2回答

    我有兩個型號: class Solution < ActiveRecord::Base belongs_to :owner, :class_name => "User", :foreign_key => :user_id end class User < ActiveRecord::Base has_many :solutions end 與以下路由: ma

    0熱度

    2回答

    賦予了博客風格的應用程序: #models class Post < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :post end #routes.rb map.resources :posts do |posts| p

    0熱度

    3回答

    因此,在我的Rails應用程序中,我有兩個屬於用戶的資源(租借和預訂)。這是我的routes.rb中的代碼來設置嵌套的路線。 map.resources :users, :has_many => :reservations, :shallow => true map.resources :users, :has_many => :rentals, :shallow => true