Class: Blazer::ChecksController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Blazer::ChecksController
- Defined in:
- app/controllers/blazer/checks_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/blazer/checks_controller.rb', line 14 def create @check = Blazer::Check.new(check_params) if @check.save redirect_to run_check_path(@check) else render :new end end |
#destroy ⇒ Object
32 33 34 35 |
# File 'app/controllers/blazer/checks_controller.rb', line 32 def destroy @check.destroy redirect_to checks_path end |
#index ⇒ Object
5 6 7 8 |
# File 'app/controllers/blazer/checks_controller.rb', line 5 def index @checks = Blazer::Check.joins(:query).includes(:query).order("state, blazer_queries.name, blazer_checks.id").to_a @checks.select! { |c| "#{c.query.name} #{c.emails}".downcase.include?(params[:q]) } if params[:q] end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/blazer/checks_controller.rb', line 10 def new @check = Blazer::Check.new end |
#run ⇒ Object
37 38 39 |
# File 'app/controllers/blazer/checks_controller.rb', line 37 def run @query = @check.query end |
#update ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/blazer/checks_controller.rb', line 24 def update if @check.update(check_params) redirect_to run_check_path(@check) else render :edit end end |