Commit 1d92fc21

mo khan <mo@mokhan.ca>
2014-01-19 16:58:23
redirect to dashboard after submitting a tutorial
1 parent 8c2cdfc
Changed files (2)
app/controllers/tutorials_controller.rb
@@ -24,7 +24,7 @@ class TutorialsController < ApplicationController
     @tutorial = current_user.tutorials.create(tutorial_params)
     current_user.tag(@tutorial, :with => params[:tutorial_tags], :on => :tags)
     if @tutorial.save
-      redirect_to tutorials_path, :notice => t(:tutorial_saved)
+      redirect_to dashboard_path, :notice => t(:tutorial_saved)
     else
       flash[:error] = @tutorial.errors.full_messages
       render :new
@@ -44,10 +44,7 @@ class TutorialsController < ApplicationController
   def destroy
     @tutorial = current_user.tutorials.find(params[:id])
     @tutorial.destroy
-
-    respond_to do |format|
-      format.html { redirect_to(tutorials_url) }
-    end
+    redirect_to dashboard_path
   end
 
   def tutorial_params
spec/controllers/tutorials_controller_spec.rb
@@ -72,7 +72,7 @@ describe TutorialsController do
       end
 
       it "redirects to the created tutorial" do
-        response.should redirect_to(tutorials_path)
+        response.should redirect_to(dashboard_path)
       end
     end
 
@@ -147,8 +147,7 @@ describe TutorialsController do
     end
 
     it "redirects to the tutorials list" do
-      response.should redirect_to(tutorials_url)
+      response.should redirect_to(dashboard_path)
     end
   end
-
 end