Rails 3路由帮助没有路由匹配



我正在创建一个RSS提要。我在视图中得到这个错误:

ActionController::RoutingError in Konkurrancers#feed
Showing C:/Rails/konkurranceportalen/app/views/konkurrancers/feed.atom.builder where line #7 raised:
No route matches {:action=>"show", :controller=>"konkurrancers", :id=>#<Konkurrancer id: 51, name: "Vind et rejsegavekort pxC3xA5 helt op til 25.000 Kroner...", banner1: "http://dk.orvillemedia.com/ads/banners/488/728x90.j...", banner2: "http://dk.orvillemedia.com/ads/banners/488/125x125....", deadline: nil, tracking: "http://dk.orvillemedia.com/ads/m/fdm_rejsegavekort_...", vaerdi: 25000, arrangeor: "Orville", note: "", udtraekkes: "2011-07-01 00:00:00", created_at: "2011-03-17 08:13:41", updated_at: "2011-04-23 19:15:58", kategori_id: 9, cached_slug: "vind-et-rejsegavekort-pxC3xA5-helt-op-til-25000-kroner-...", tid: "30 sek", form: "Nyhedsbrev", partner: "Orville", bedom: 5, rating_score: 104, ratings: 25, rating: 0>}
Extracted source (around line #7):
4: 
5: for konkurrancer in @posts
6:     next if konkurrancer.updated_at.blank?  
7:         feed.entry(konkurrancer) do |entry|
8:             entry.title(konkurrancer.name)  
9:             entry.updated(konkurrancer.updated_at.strftime("%Y-%m-dT%H:%M:%SZ"))
10:         end

My atom feed builder:

atom_feed do |feed|
    feed.title("the dev station")
feed.updated(@posts.first.created_at) #omit .strftime
for konkurrancer in @posts
    next if konkurrancer.updated_at.blank?  
        feed.entry(konkurrancer) do |entry|
            entry.title(konkurrancer.name)  
            entry.updated(konkurrancer.updated_at.strftime("%Y-%m-dT%H:%M:%SZ"))
        end
  end
end
我route.rb

:

match '/feed' => 'konkurrancers#feed',
      :as => :feed,
      :defaults => { :format => 'atom' }
match '/:kategoris/:cached_slug' => 'konkurrancers#show', :as => 'konkurrance'
match '/:id' => 'kategoris#show'

代替链接到konkurrancer的显示动作的RSS提要。我想要它链接到我的konkurrancer表的一列,这是一个url。

试试这个

feed.entry(konkurrancer, :id => konkurrancer.id) do |entry|

乌利希期刊指南

feed.entry(konkurrancer, :url => konkurrancer.tracking) do |entry|

相关内容

  • 没有找到相关文章

最新更新