Skip to content

Commit

Permalink
if requiring user to log in for an action, it will now return user to…
Browse files Browse the repository at this point in the history
… that action's page
  • Loading branch information
paulcc committed Mar 20, 2009
1 parent 7b6d7cd commit 2347547
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/controllers/reviews_controller.rb
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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?
Expand All @@ -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

0 comments on commit 2347547

Please sign in to comment.