<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -143,11 +143,19 @@ class NiftyScaffoldGenerator &lt; Rails::Generator::Base
     end
   end
   
+  def items_path(suffix = 'path')
+    if action? :index
+      &quot;#{plural_name}_#{suffix}&quot;
+    else
+      &quot;root_#{suffix}&quot;
+    end
+  end
+  
   def item_path(suffix = 'path')
     if action? :show
       &quot;@#{singular_name}&quot;
     else
-      &quot;#{plural_name}_#{suffix}&quot;
+      items_path(suffix)
     end
   end
   
@@ -155,7 +163,7 @@ class NiftyScaffoldGenerator &lt; Rails::Generator::Base
     if action? :show
       &quot;#{singular_name}_#{suffix}(assigns[:#{singular_name}])&quot;
     else
-      &quot;#{plural_name}_#{suffix}&quot;
+      items_path(suffix)
     end
   end
   
@@ -163,7 +171,7 @@ class NiftyScaffoldGenerator &lt; Rails::Generator::Base
     if action? :show
       &quot;#{singular_name}_#{suffix}(assigns(:#{singular_name}))&quot;
     else
-      &quot;#{plural_name}_#{suffix}&quot;
+      items_path(suffix)
     end
   end
   </diff>
      <filename>rails_generators/nifty_scaffold/nifty_scaffold_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,5 +2,5 @@
     @&lt;%= singular_name %&gt; = &lt;%= class_name %&gt;.find(params[:id])
     @&lt;%= singular_name %&gt;.destroy
     flash[:notice] = &quot;Successfully destroyed &lt;%= name.humanize.downcase %&gt;.&quot;
-    redirect_to &lt;%= plural_name %&gt;_url
+    redirect_to &lt;%= items_path('url') %&gt;
   end</diff>
      <filename>rails_generators/nifty_scaffold/templates/actions/destroy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
   it &quot;destroy action should destroy model and redirect to index action&quot; do
     &lt;%= singular_name %&gt; = &lt;%= class_name %&gt;.first
     delete :destroy, :id =&gt; &lt;%= singular_name %&gt;
-    response.should redirect_to(&lt;%= plural_name %&gt;_url)
+    response.should redirect_to(&lt;%= items_path('url') %&gt;)
     &lt;%= class_name %&gt;.exists?(&lt;%= singular_name %&gt;.id).should be_false
   end</diff>
      <filename>rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
     should &quot;destroy model and redirect to index action&quot; do
       &lt;%= singular_name %&gt; = &lt;%= class_name %&gt;.first
       delete :destroy, :id =&gt; &lt;%= singular_name %&gt;
-      assert_redirected_to &lt;%= plural_name %&gt;_url
+      assert_redirected_to &lt;%= items_path('url') %&gt;
       assert !&lt;%= class_name %&gt;.exists?(&lt;%= singular_name %&gt;.id)
     end
   end</diff>
      <filename>rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
   def test_destroy
     &lt;%= singular_name %&gt; = &lt;%= class_name %&gt;.first
     delete :destroy, :id =&gt; &lt;%= singular_name %&gt;
-    assert_redirected_to &lt;%= plural_name %&gt;_url
+    assert_redirected_to &lt;%= items_path('url') %&gt;
     assert !&lt;%= class_name %&gt;.exists?(&lt;%= singular_name %&gt;.id)
   end</diff>
      <filename>rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -139,7 +139,7 @@ class TestNiftyScaffoldGenerator &lt; Test::Unit::TestCase
           assert_match &quot;@line_item = LineItem.new(params[:line_item])&quot;, body
           assert_match &quot;if @line_item.save&quot;, body
           assert_match &quot;flash[:notice] = \&quot;Successfully created line item.\&quot;&quot;, body
-          assert_match &quot;redirect_to line_items_url&quot;, body
+          assert_match &quot;redirect_to root_url&quot;, body
           assert_match &quot;render :action =&gt; 'new'&quot;, body
         end
       end
@@ -164,7 +164,7 @@ class TestNiftyScaffoldGenerator &lt; Test::Unit::TestCase
           assert_match &quot;def update&quot;, body
           assert_match &quot;if @line_item.update_attributes(params[:line_item])&quot;, body
           assert_match &quot;flash[:notice] = \&quot;Successfully updated line item.\&quot;&quot;, body
-          assert_match &quot;redirect_to line_items_url&quot;, body
+          assert_match &quot;redirect_to root_url&quot;, body
           assert_match &quot;render :action =&gt; 'edit'&quot;, body
         end
       end
@@ -181,7 +181,7 @@ class TestNiftyScaffoldGenerator &lt; Test::Unit::TestCase
           assert_match &quot;@line_item = LineItem.find(params[:id])&quot;, body
           assert_match &quot;@line_item.destroy&quot;, body
           assert_match &quot;flash[:notice] = \&quot;Successfully destroyed line item.\&quot;&quot;, body
-          assert_match &quot;redirect_to line_items_url&quot;, body
+          assert_match &quot;redirect_to root_url&quot;, body
         end
       end
     end
@@ -256,6 +256,7 @@ class TestNiftyScaffoldGenerator &lt; Test::Unit::TestCase
         assert_generated_file &quot;app/controllers/line_items_controller.rb&quot; do |body|
           assert_match &quot;def create&quot;, body
           assert_match &quot;def update&quot;, body
+          assert_match &quot;root_url&quot;, body
         end
       end
     end</diff>
      <filename>test/test_nifty_scaffold_generator.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7b5f755e640c72ae766cda2b403f7c269d8fe868</id>
    </parent>
  </parents>
  <author>
    <name>Ryan Bates</name>
    <email>ryan@railscasts.com</email>
  </author>
  <url>http://github.com/ryanb/nifty-generators/commit/9860f10b7683015aa902dd31cfbe85882860c934</url>
  <id>9860f10b7683015aa902dd31cfbe85882860c934</id>
  <committed-date>2009-05-05T10:45:47-07:00</committed-date>
  <authored-date>2009-05-05T10:45:47-07:00</authored-date>
  <message>redirecting to root_url if index action doesn't exist for nifty_scaffold - closes #4</message>
  <tree>6db6b7b487ac16bd473d36ba7970e47779a5a2bc</tree>
  <committer>
    <name>Ryan Bates</name>
    <email>ryan@railscasts.com</email>
  </committer>
</commit>
