From 234754763792b36a303848c00b7d904e1cf37aca Mon Sep 17 00:00:00 2001 From: paulcc Date: Fri, 20 Mar 2009 13:55:50 +0000 Subject: [PATCH] if requiring user to log in for an action, it will now return user to that action's page --- app/controllers/reviews_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/reviews_controller.rb b/app/controllers/reviews_controller.rb index de8c741..9ce8d00 100644 --- a/app/controllers/reviews_controller.rb +++ b/app/controllers/reviews_controller.rb @@ -1,8 +1,7 @@ class ReviewsController < ApplicationController helper Spree::BaseHelper - before_filter :login_required # no reviews without login first + before_filter :require_user_account # no reviews without login first - # def submit @review = Review.new :product_id => params[:id] @product = Product.find_by_id params[:id] @@ -12,7 +11,6 @@ def submit def create @review = Review.new :product_id => params[:id] @product = Product.find_by_id params[:review][:product_id] - if @review.update_attributes(params[:review]) if @product.rating.nil? @@ -26,4 +24,11 @@ def create end end + private + def require_user_account + return if logged_in? + store_location + redirect_to signup_path + end + end