Note that there are some explanatory texts on larger screens.

plurals
  1. POurl in atom feed-builder behaves different to erb-template with nested resource
    primarykey
    data
    text
    <p>I have the following nested resource:</p> <pre><code>resources :categories, :only =&gt; [:show], :path =&gt; "" do resources :games, :only =&gt; [:show], :path =&gt; "" do end </code></pre> <p>To retrieve all items i do:</p> <pre><code> @feeditems = Game.all(:include =&gt; [:categorygames =&gt; :category]) </code></pre> <p>To show them in an .erb template:</p> <pre><code>&lt;%= category_game_path(feeditem.categorygames.first.category, feeditem) %&gt; </code></pre> <p>This works fine so far. Now i wanted to use the same way to include the url in a atom feed. I have to specify the url, so i did the following:</p> <pre><code>@feeditems.each do |feeditem| feed.entry(feeditem, :url =&gt; category_game_path(feeditem.categorygames.first.category, feeditem)) do |entry| entry.title feeditem.name_de ... </code></pre> <p>Unfortunately i always get a "NoMethodError"-Error, and "undefined method `category_game__path' #&lt;#:0x007fa7c96c3090>"</p> <p>Why does builder behaves different to a .erb-template? Any idea, how can sort this out?</p> <p><strong>EDIT</strong></p> <p>I got one step further, since <a href="https://stackoverflow.com/questions/1198484/nested-resource-with-atom-feed-helper?rq=1">someone else</a> had a similar problem.</p> <p>I changed it to this:</p> <pre><code> feed.entry(:url =&gt; url_for(:action =&gt; 'show', :controller =&gt;'games', :category_id =&gt; feeditem.categorygames.first.category, :id =&gt; feeditem, :only_path =&gt; false)) do |entry| </code></pre> <p>Now i get this error:</p> <pre><code> undefined method `id' for {:url=&gt;"http://localhost:3000/sport-games/wizard-game"}:Hash </code></pre> <p>Still, i do not have an idea so solve this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload