0
型號:這個幫手是如何工作的?
Group:
has_many :booth_marketing_messages, :dependent => :destroy
Booth Marketing Message:
belongs_to :group
路線:
resources :groups do
member do
get :get_group_links
get :booth_marketing_messages
end
resources :booth_marketing_messages do
member do
match :toggle_activation
end
end
end
爲了創建一個新的展臺營銷信息我有一個觀點:
<% form_for :asset, :url => (defined?(msg) ? group_booth_marketing_message_path(msg) :
group_booth_marketing_messages_path), :html => { :multipart => true, :method =>
(defined?(msg) && msg ? :put : :post) } do |f| -%>
.......
當我運行耙路線:
booth_marketing_messages_group GET /groups/:id/booth_marketing_messages(.:format)
{:action=>"booth_marketing_messages", :controller=>"groups"}
group_booth_marketing_messages GET
/groups/:group_id/booth_marketing_messages(.:format)
{:action=>"index", :controller=>"booth_marketing_messages"}
但我的攤位營銷消息控制器沒有索引操作。是的,這條路線不會失敗,那是怎麼回事?
我明白你是什麼sayign但是「但是當你去那個網址時,你會得到錯誤的行爲沒有找到或控制器不存在。」 - 多數民衆贊成的事情,我不必爲BoothMarketingMessagesController索引行動/索引視圖,但我在'新'行動的形式中提到的網址沒有拋出任何錯誤...我想知道爲什麼它不是拋出一個錯誤? – user1865578 2013-03-22 13:26:11
意思是如果你在瀏覽器中輸入該網址你沒有得到像「未知動作」的錯誤? 那麼你會得到什麼?任何頁面? – jbmyid 2013-03-22 13:33:16
是的,它不拋出任何錯誤而是被路由到booth_marketing_messages_group_path – user1865578 2013-03-22 13:42:16