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 23 24 25 |
# File 'app/controllers/blazer/checks_controller.rb', line 14 def create @check = Blazer::Check.new(check_params) # use creator_id instead of creator # since we setup association without checking if column exists @check.creator = blazer_user if @check.respond_to?(:creator_id=) if @check.save redirect_to run_check_path(@check) else render :new end end |
#destroy ⇒ Object
35 36 37 38 |
# File 'app/controllers/blazer/checks_controller.rb', line 35 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
40 41 42 |
# File 'app/controllers/blazer/checks_controller.rb', line 40 def run @query = @check.query end |
#update ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/blazer/checks_controller.rb', line 27 def update if @check.update(check_params) redirect_to run_check_path(@check) else render :edit end end |