Class: KafkaCommand::ClustersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- KafkaCommand::ClustersController
- Defined in:
- app/controllers/kafka_command/clusters_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /clusters.
-
#show ⇒ Object
GET /clusters/:id.
Instance Method Details
#index ⇒ Object
GET /clusters
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/kafka_command/clusters_controller.rb', line 8 def index @clusters = Cluster.all flash[:search] = params[:name] if params[:name].present? @clusters = @clusters.select do |c| regex = /#{params[:name]}/i c.name.match?(regex) end end redirection_path = new_cluster_path if Cluster.none? render_success(@clusters, redirection_path: redirection_path, flash: flash.to_hash) end |
#show ⇒ Object
GET /clusters/:id
25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/kafka_command/clusters_controller.rb', line 25 def show @cluster = Cluster.find(params[:id]) if @cluster render_success(@cluster) else record_not_found end end |