Class: Stay::Admin::ReviewsController

Inherits:
BaseController show all
Defined in:
app/controllers/stay/admin/reviews_Controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#load_stores, #set_currency, #set_current_store, #stores_scope

Methods included from ControllerHelpers::Store

#current_store, #ensure_current_store, #store_locale

Methods included from ControllerHelpers::Currency

#currency_param, #current_currency, #supported_currencies, #supported_currencies_for_all_stores, #supported_currency?

Methods inherited from Stay::ApplicationController

#after_sign_in_path_for, #current_store

Methods included from LocaleHelper

#all_locales_options, #available_locales, #available_locales_options, #config_locale?, #current_locale, #find_with_fallback_default_locale, #locale_full_name, #locale_param, #locale_presentation, #params_locale?, #should_render_locale_dropdown?, #supported_locale?, #supported_locales, #supported_locales_for_all_stores, #supported_locales_options, #user_locale?

Methods included from CurrencyHelper

#currency_options, #currency_presentation, #currency_symbol, #should_render_currency_dropdown?, #supported_currency_options

Instance Method Details

#createObject

POST /reviews



25
26
27
28
29
30
31
32
33
# File 'app/controllers/stay/admin/reviews_Controller.rb', line 25

def create
  @review = Stay::Review.new(review_params)

  if @review.save
    redirect_to admin_review_path(@review), notice: 'Review was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /reviews/1



45
46
47
48
# File 'app/controllers/stay/admin/reviews_Controller.rb', line 45

def destroy
  @review.destroy
  redirect_to admin_reviews_url, notice: 'Review was successfully destroyed.'
end

#editObject

GET /reviews/1/edit



21
22
# File 'app/controllers/stay/admin/reviews_Controller.rb', line 21

def edit
end

#indexObject

GET /reviews



7
8
9
# File 'app/controllers/stay/admin/reviews_Controller.rb', line 7

def index
  @reviews = Stay::Review.page(params[:page])
end

#newObject

GET /reviews/new



16
17
18
# File 'app/controllers/stay/admin/reviews_Controller.rb', line 16

def new
  @review = Stay::Review.new
end

#showObject

GET /reviews/1



12
13
# File 'app/controllers/stay/admin/reviews_Controller.rb', line 12

def show
end

#updateObject

PATCH/PUT /reviews/1



36
37
38
39
40
41
42
# File 'app/controllers/stay/admin/reviews_Controller.rb', line 36

def update
  if @review.update(review_params)
    redirect_to admin_review_path(@review), notice: 'Review was successfully updated.'
  else
    render :edit
  end
end