<br>resources_controller (+1!) is definitely your friend with dealing with contextual views for polymorphic controllers.<br><br>e.g.<br><br>    /authors/id/books<br>    /publishers/id/books<br><br>if both Author and Publisher have a name method then the book show view can contain something like
<br><br>    <%= link_to enclosing_resource.name, enclosing_resource_path %><br><br>or in rails 2.0 you could do<br><br>     <%= render :partial => enclosing_resource %>   <br><br>which would automatically use either authors/_author.html.erb or publishers/_publisher.html.erb
<br><br>Jason.<br><br><div><span class="gmail_quote">On 11/5/07, <b class="gmail_sendername">Craig Webster</b> <<a href="mailto:craig@xeriom.net">craig@xeriom.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 5 Nov 2007, at 14:04, Anthony Green wrote:<br>> I had a brief glance at this but was concerned it was very naïve<br>> about view<br>> contexts<br><br>I guess it depends on how different the view should be. In most cases
<br>I'd say a book should be marked up the same way whether it's through<br>an author or through a publisher.<br><br>> "* test for the existence of @user or @forum in the view, and<br>> display it<br>> differently"
<br>><br>> don't instill much confidence<br><br>Using enclosing_resource_name, enclosing_resource_path,<br>enclosing_resource, resource_path etc will handle most if not all of<br>my use cases. I'm not sure I'd ever test for @user / @forum - a post
<br>should show the title, message, date posted, author, comments whether<br>it's displayed in a forum or in the users recent posts list.<br><br>Cheers,<br>Craig<br>--<br>Craig Webster   | Lead Developer   | skype: craigwebster
<br>Xeriom Networks | t: 0131 208 3800 | w: <a href="http://xeriom.net/">http://xeriom.net/</a><br><br>   -- Virtual machines, dedicated servers and colocation --<br><br>Xeriom Networks Limited.<br>94/1 Spring Gardens, Abbeyhill, Edinburgh, Scotland.
<br>Registered in England and Wales. Company No. 5961686.<br><br>All agreements are made under our standard terms and conditions.<br>These can<br>be found at <a href="http://xeriom.net/terms_and_conditions">http://xeriom.net/terms_and_conditions
</a><br><br><br>_______________________________________________<br>Chat mailing list<br><a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org">http://lists.lrug.org/listinfo.cgi/chat-lrug.org
</a><br></blockquote></div><br>