nested-resources

    0熱度

    1回答

    我不完全明白爲什麼會發生這種情況,也許你們中的某些人做了......在這裏。 我創建了一個嵌套的資源: resources :order do resources :ordered_vehicles end 我添加了一個link_to的new行動,並通過了order.id像這樣new_order_ordered_vehicle_path(order.id)在頁面加載很好。問題出在我

    0熱度

    1回答

    我試圖通過將以下內容傳遞給create來創建Gallery模型及其has_many關聯。 [ { "title":"Some Titler", "description":"", "date":"18-3-2012", "photographs":[ { "title": "Some Title", "camer

    1熱度

    1回答

    我有這樣的路線 resources :childs do resources :draws end resources :draws 我如何寫一個_form.htm.erb添加和編輯汲取? 我的意思是,從new_draw_path我會用form_for(@draw),然後選擇孩子f.select幫手 和new_child_draw_path我會用form_for([@child,

    1熱度

    1回答

    我的Capapara RSPEC測試有一些困難,我有一個嵌套的資源。這裏的錯誤我收到: 1) Photo pages visit photo path Photo can be visited after FactoryGirl create records ←[31mFailure/Error:←[0m ←[31mvisit mountain_photo_path(mountain, photo

    1熱度

    1回答

    熊處理很多關係,我爲我是一個Rails小白當找到正確的嵌套的資源。我有一個基本的聯賽制度。聯賽 - >季 - >分區 - >球隊。我希望我的部門和團隊屬於任何季節。我的型號如下... class Season < ActiveRecord::Base belongs_to :league has_many :season_division_teams has_many

    14熱度

    3回答

    我有一個屬於許多不同模型的嵌套資源。例如: resources :users do resources :histories, only: [:show] end resources :publications do resources :histories, only: [:show] end resources :events do resources

    0熱度

    1回答

    我可以導入CSV文件,並使用單個模型中的屬性創建一個新對象(本例中列出)。 我把這個上市模型 accepts_nested_attributes_for :address ,其中地址是相關的模型(地址有許多房源,房源屬於地址)。 我當時認爲我能夠大規模從分配地址模型導入CSV文件時,還會爲屬性,但我得到的錯誤: Can't mass-assign protected attributes: u

    6熱度

    2回答

    在Rails 3.2.11,我有以下路由定義 resources :foos do resources :bars resources :bangs, :controller => 'foos/bangs' end 這導致以下路線 foo_bars GET /foos/:foo_id/bars(.:format) bars#index POST /f

    11熱度

    4回答

    我是一個完全新手在Rails中。 我已經創建了一個Web應用程序,我可以通過/posts/123/comments/或/posts/123/comments/new訪問,但我不知道如何使用的link_to在索引視圖來顯示具體的評論,當我嘗試連接它,會出現「無路由「或」未定義符號「。 我在模型中定義的帖子和評論之間有嵌套的have_many關係,並且在我執行rake路由時出現routes.rb和po

    0熱度

    1回答

    所以我就遇到了這個問題範圍的路線和的form_for:form_for and scopes, rails 3 我的問題更糟糕的是,雖然因爲我不只想範圍內的所有方法,我想大家是在除了GET「/管理員」 /節目。 所以我的routes.rb有這樣的事情: scope '/admin' do resources 'lessons', except: [:show] end get "le