Class: Teaspoon::SuiteController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Teaspoon::SuiteController
- Defined in:
- app/controllers/teaspoon/suite_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.before(*args) ⇒ Object
2 3 4 |
# File 'app/controllers/teaspoon/suite_controller.rb', line 2 def self.before(*args) respond_to?(:before_action) ? before_action(*args) : before_filter(*args) end |
Instance Method Details
#fixtures ⇒ Object
30 31 32 |
# File 'app/controllers/teaspoon/suite_controller.rb', line 30 def fixtures render template: "/#{params[:filename]}" end |
#hook ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/teaspoon/suite_controller.rb', line 19 def hook hooks = Teaspoon::Suite.new(params).hooks[params[:hook].to_s] if hooks.present? hooks.each { |hook| hook.call(hook_params(params[:args])) } head(:ok) else render status: :not_found, json: { err: "The `#{params[:hook]}` hook is not defined in the `#{params[:suite]}` suite " } end end |
#index ⇒ Object
11 12 13 |
# File 'app/controllers/teaspoon/suite_controller.rb', line 11 def index @suites = Teaspoon::Suite.all end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/teaspoon/suite_controller.rb', line 15 def show @suite = Teaspoon::Suite.new(params) end |