2014-10-01 31 views
0

這可能是一個微不足道的問題,但還沒有找到答案... 我想添加鏈接到我的ActionMailer,使用:only_path => false選項。將鏈接選項添加到link_to指向一個未知類型的對象

我鏈接到一個對象@event是未知類型的,所以我不能使用舊的語法:controller => 'something', :action => :show etc.event_path(@event)

總之,這樣的:

link_to 'Please RSVP', @event, :only_path => false 

...不按預期工作,:only_path選項將被忽略。我試過{}的變體,但無濟於事。

什麼是正確的語法?

回答

0

我最終在不同的SO線程中找到解決方案。

使用polymorphic_path幫手。記錄here

因此,對於上面的:

<%= link_to 'RSVP now', polymorphic_path(@event, :only_path => false) %> 
相關問題