Class: ExceptionTrack::LogsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ExceptionTrack::LogsController
- Defined in:
- app/controllers/exception_track/logs_controller.rb
Instance Method Summary collapse
-
#all ⇒ Object
DELETE /exception_logs/all.
- #export ⇒ Object
-
#index ⇒ Object
GET /exception_logs.
-
#show ⇒ Object
GET /exception_logs/1.
Instance Method Details
#all ⇒ Object
DELETE /exception_logs/all
22 23 24 25 |
# File 'app/controllers/exception_track/logs_controller.rb', line 22 def all Log.delete_all redirect_to logs_url, notice: "Logs was successfully destroyed." end |
#export ⇒ Object
13 14 15 16 |
# File 'app/controllers/exception_track/logs_controller.rb', line 13 def export @logs = Log.order("id desc").where("created_at >= ?", 3.months.ago) send_data JSON.pretty_generate(@logs.as_json(only: %i[title body created_at updated_at])), filename: "#{Date.current}.json", disposition: "attachment" end |
#index ⇒ Object
GET /exception_logs
9 10 11 |
# File 'app/controllers/exception_track/logs_controller.rb', line 9 def index @logs = Log.order("id desc").page(params[:page]).per(15) end |
#show ⇒ Object
GET /exception_logs/1
19 |
# File 'app/controllers/exception_track/logs_controller.rb', line 19 def show; end |