Class: Intro::ToursController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Intro::ToursController
- Defined in:
- app/controllers/intro/tours_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#index ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/intro/tours_controller.rb', line 13 def index return unless Intro.config.visible_without_signing_in || current_user tours = Intro::Tour.with_controller_and_action(params[:controller_path], params[:action_name]) tours = tours.published Intro.cache.write(params[:controller_path], params[:action_name], tours.any?) if Intro.config.cache tours = filter_tours_by_route(tours) tours = filter_tours_by_histories(tours) tours = filter_tours_by_expired_time(tours) tours = filter_tours_by_signed_in(tours) render json: { data: tours.map(&:expose_attributes) } end |
#record ⇒ Object
29 30 31 32 33 |
# File 'app/controllers/intro/tours_controller.rb', line 29 def record history = Intro::TourHistory.with_user_and_tour(current_user, @tour).first_or_initialize history.increment!(:touch_count) render json: { message: t('intro.admin.update_success') } end |