Class: Overule::RulesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Overule::RulesController
- Defined in:
- app/controllers/overule/rules_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/overule/rules_controller.rb', line 21 def create @rule = Rule.new(rule_params) if @rule.save redirect_to @rule, notice: "Rule created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
38 39 40 41 |
# File 'app/controllers/overule/rules_controller.rb', line 38 def destroy @rule.destroy redirect_to rules_path, notice: "Rule deleted." end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/overule/rules_controller.rb', line 17 def edit # Rendered implicitly: the edit view consumes @rule loaded by set_rule. end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/overule/rules_controller.rb', line 5 def index @rules = Rule.order(:name) end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/overule/rules_controller.rb', line 13 def new @rule = Rule.new(definition: Rule::BLANK_DEFINITION.deep_dup) end |
#show ⇒ Object
9 10 11 |
# File 'app/controllers/overule/rules_controller.rb', line 9 def show # Rendered implicitly: the show view consumes @rule loaded by set_rule. end |
#update ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/overule/rules_controller.rb', line 30 def update if @rule.update(rule_params) redirect_to @rule, notice: "Rule updated." else render :edit, status: :unprocessable_entity end end |