Class: SearchHistoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SearchHistoriesController
- Defined in:
- app/controllers/search_histories_controller.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
DELETE /search_histories/1 DELETE /search_histories/1.json.
-
#index ⇒ Object
GET /search_histories GET /search_histories.json.
- #remove_all ⇒ Object
-
#show ⇒ Object
GET /search_histories/1 GET /search_histories/1.json.
Instance Method Details
#destroy ⇒ Object
DELETE /search_histories/1 DELETE /search_histories/1.json
39 40 41 42 43 44 45 46 |
# File 'app/controllers/search_histories_controller.rb', line 39 def destroy @search_history.destroy respond_to do |format| format.html { redirect_to search_histories_url } format.json { head :no_content } end end |
#index ⇒ Object
GET /search_histories GET /search_histories.json
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/search_histories_controller.rb', line 7 def index if params[:mode] == 'not_found' #if current_user.has_role?('Administrator') # @search_histories = SearchHistory.not_found.order('created_at DESC').page(params[:page]) #else @search_histories = current_user.search_histories.not_found.order('created_at DESC').page(params[:page]) #end else #if current_user.has_role?('Administrator') # @search_histories = SearchHistory.order('created_at DESC').page(params[:page]) #else @search_histories = current_user.search_histories.order('created_at DESC').page(params[:page]) #end end respond_to do |format| format.html # index.html.erb format.json { render json: @search_histories.to_json } end end |
#remove_all ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'app/controllers/search_histories_controller.rb', line 48 def remove_all SearchHistory.remove_all_history(current_user) respond_to do |format| format.html { redirect_to search_histories_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.search_history')) } format.json { head :no_content } end end |
#show ⇒ Object
GET /search_histories/1 GET /search_histories/1.json
30 31 32 33 34 35 |
# File 'app/controllers/search_histories_controller.rb', line 30 def show respond_to do |format| format.html # show.html.erb format.json { render json: @search_history.to_json } end end |