Class: Admin::ReviewsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- Admin::ReviewsController
- Defined in:
- app/controllers/admin/reviews_controller.rb
Constant Summary
Constants inherited from BaseController
BaseController::INTERNAL_SERVER_ERROR_MESSAGE
Instance Attribute Summary collapse
-
#review ⇒ Object
readonly
Returns the value of attribute review.
Instance Method Summary collapse
Methods inherited from BaseController
#destroy_session, #identity_cache_memoization, #sign_in_page, #user_developer_session
Methods included from LogrageCustomLogger
Methods included from AdminHelper
#dynamic_pricings_formatter, #link_to_admin_reservations_path_by_id, #link_to_admin_restaurants_path_by_id, #link_to_log, #optional_locales, #optional_locales_with_labels, #staff_signed_in?
Methods included from UpdateLocaleConcern
Methods inherited from ApplicationController
#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=
Methods included from ControllerHelpers
#check_boolean_param, #get_banners, #inventory_params, #reservation_params
Instance Attribute Details
#review ⇒ Object (readonly)
Returns the value of attribute review.
8 9 10 |
# File 'app/controllers/admin/reviews_controller.rb', line 8 def review @review end |
Instance Method Details
#destroy ⇒ Object
36 37 38 39 40 41 |
# File 'app/controllers/admin/reviews_controller.rb', line 36 def destroy review = ::Review.find(params[:id]) review.update_stat_before_destroy_review redirect_to admin_reviews_path end |
#edit ⇒ Object
19 |
# File 'app/controllers/admin/reviews_controller.rb', line 19 def edit; end |
#index ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/admin/reviews_controller.rb', line 10 def index title: 'Reviews Overview' @grid = ::ReviewsGrid.new(params[:reviews_grid]) do |scope| scope.page(params[:page]).per(50) end return unless stale_etag? @grid.assets end |
#update ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/admin/reviews_controller.rb', line 21 def update update_disclose_review(review) if review.update(params.require(:review).permit(:review, :rating, :featured)) flash[:notice] = 'Review updated successfully' redirect_to admin_reviews_path else flash.now[:alert] = review.errors..to_sentence render :edit end rescue StandardError => e flash.now[:alert] = e. render :edit end |