<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -182,13 +182,13 @@ class ResourcefulViews
   # 
   #   &lt;a href=&quot;/tables/1&quot; class=&quot;show table show_table&quot;&gt;Linoleum&lt;/a&gt;
   #
-  def build_show_helper(resource)
+  def build_show_helper(resource) 
     helper_name = &quot;show_#{resource.name_prefix}#{resource.singular}#{@@link_helpers_suffix}&quot;
     return if already_defined?(helper_name)
     @module.module_eval &lt;&lt;-end_eval
       def #{helper_name}(*args)
         opts = args.extract_options!
-        label = opts.delete(:label) || 'Show'
+        label = opts.delete(:label) || #{resource.kind_of?(ActionController::Resources::SingletonResource) ? &quot;'Show'&quot; : 'args.last.to_s'}
         opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}', 'show', *(opts.delete(:class) || '').split)
         opts[:sending] = opts.delete(:parameters) and ResourcefulViews.deprecation_warning('Please use :sending instead of :parameters') if opts[:parameters]
         args &lt;&lt; opts.delete(:sending) if opts[:sending]</diff>
      <filename>lib/resourceful_views.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,7 @@ describe 'show_resource with plural resource' do
     end
     @view = ActionView::Base.new
     @view.stub!(:table_path).and_return('/tables/1')
-    @table = mock('table', :to_param =&gt; 1)
+    @table = mock('table', :to_param =&gt; 1, :to_s =&gt; 'Dining Table')
   end
   
   it &quot;should create a link with resourceful classes&quot; do
@@ -36,9 +36,10 @@ describe 'show_resource with plural resource' do
     markup.should have_tag('a[href=/tables/1#special]')
   end
   
-  it &quot;should have the label 'Show' by default&quot; do
+  it &quot;should use the return value of the model's 'to_s' method as a label by default&quot; do
+    @table.should_receive(:to_s).and_return('Walnut-top dining table')
     markup = @view.show_table(@table)
-    markup.should have_tag('a', 'Show')
+    markup.should have_tag('a', 'Walnut-top dining table')
   end
   
   it &quot;should allow passing in a custom label&quot; do
@@ -83,7 +84,7 @@ describe 'show_resource with plural nested resource' do
     @view = ActionView::Base.new
     @view.stub!(:table_leg_path).and_return('/tables/1/legs/1')
     @table = mock('table')
-    @leg = mock('leg')
+    @leg = mock('leg', :to_s =&gt; 'Metal leg')
   end
   
   it &quot;should create a link with resourceful classes&quot; do
@@ -102,9 +103,10 @@ describe 'show_resource with plural nested resource' do
     markup.should have_tag('a[href=/tables/1/legs/1]')
   end
   
-  it &quot;should have the label 'Show' by default&quot; do
+  it &quot;should use the return value of the model's 'to_s' method as a label by default&quot; do
+    @leg.should_receive(:to_s).and_return('Brushed-metal leg')
     markup = @view.show_table_leg(@table, @leg)
-    markup.should have_tag('a', 'Show')
+    markup.should have_tag('a', 'Brushed-metal leg')
   end
   
   it &quot;should allow passing in a custom label&quot; do
@@ -158,7 +160,9 @@ describe 'show_resource for singular nested resource' do
     markup.should have_tag('a[href=/table/1/top]')
   end
   
-  it &quot;should have the label 'Show' by default&quot; do
+  # We can not easily derive a default here from the parameters provided
+  # Without going through the AR association about which RV probably should hot make any assumptions
+  it &quot;should use 'Show' as a label by default&quot; do
     markup = @view.show_table_top(@table)
     markup.should have_tag('a', 'Show')
   end</diff>
      <filename>spec/show_helper_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>dde0e82c79daba88c5b13cbd49378f31c75d9e28</id>
    </parent>
  </parents>
  <author>
    <name>Ingo Weiss</name>
    <email>ingo@ingoweiss.com</email>
  </author>
  <url>http://github.com/ingoweiss/resourceful_views/commit/82de7c86d466f37b788d948f1df50ff872cddeee</url>
  <id>82de7c86d466f37b788d948f1df50ff872cddeee</id>
  <committed-date>2008-12-08T13:18:37-08:00</committed-date>
  <authored-date>2008-12-08T13:18:37-08:00</authored-date>
  <message>Show helpers for plural resources now use the return value of 'to_s' of the last argument provided as a default label [#2]:
So now you can write show_event(event) instead of show_event(event, :label =&gt; event.name) after implementing to_s to return the event's name</message>
  <tree>c12ab5fd2cb9ce13e9c2c49bf500cb693f9c8edf</tree>
  <committer>
    <name>Ingo Weiss</name>
    <email>ingo@ingoweiss.com</email>
  </committer>
</commit>
