app/controllers/swimming_pool_reviews_controller.rb
# Returns the reviews found for a specific swimmin_pool id.
#
# === Params:
# - id: the SwimmingPool.id
#
Returns the reviews found for a specific swimmin_pool id.
Returns the reviews found for a specific swimmin_pool id .
def for_swimming_pool
    @swimming_pool_id = params[:id]
    @reviews = SwimmingPoolReview.where( swimming_pool_id: @swimming_pool_id )
    @reviews.sort{ |a,b| (a.votes_for.down.count - a.votes_for.up.count) <=> (b.votes_for.down.count - b.votes_for.up.count) }
    respond_with( @reviews )
  end
def for_swimming_pool @swimming_pool_id = params [ :id ] @reviews = SwimmingPoolReview . where ( swimming_pool_id : @swimming_pool_id ) @reviews . sort { | a , b | ( a . votes_for . down . count - a . votes_for . up . count ) <=> ( b . votes_for . down . count - b . votes_for . up . count ) } respond_with ( @reviews ) end
Returns the reviews found for a specific swimmin_pool id.
Returns the reviews found for a specific swimmin_pool id .