Sha256: 5da3d4a9f737ca6df228d7553d658c59055605aa2044070d9fa4a72b92994edc
Contents?: true
Size: 885 Bytes
Versions: 3
Compression:
Stored size: 885 Bytes
Contents
class ReviewsController < Spree::BaseController helper Spree::BaseHelper def index @product = Product.find_by_permalink params[:product_id] @approved_reviews = Review.approved.find_all_by_product_id(@product.id) end def new @product = Product.find_by_permalink params[:product_id] @review = Review.new :product => @product end # save if all ok def create @product = Product.find_by_permalink params[:product_id] params[:review][:rating].sub!(/\s*stars/,'') unless params[:review][:rating].blank? @review = Review.new :product => @product if @review.update_attributes(params[:review]) flash[:notice] = t('review_successfully_submitted') redirect_to (product_path(@product)) else # flash[:notice] = 'There was a problem in the submitted review' render :action => "new" end end def terms end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spree_reviews-0.50.1 | app/controllers/reviews_controller.rb |
spree_reviews-0.50.0 | app/controllers/reviews_controller.rb |
spree_reviews-0.30.0 | app/controllers/reviews_controller.rb |