Sha256: bb003eae4a100fb285e0f52205975b04adbc2930c70c3e4c7e5af122cf94b301
Contents?: true
Size: 901 Bytes
Versions: 2
Compression:
Stored size: 901 Bytes
Contents
# frozen_string_literal: true require_dependency 'kafka_command/application_controller' module KafkaCommand class ClustersController < ApplicationController # GET /clusters 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 render_success(@clusters, flash: flash.to_hash) end # GET /clusters/:id def show @cluster = Cluster.find(params[:id]) if @cluster render_success(@cluster) else record_not_found end end private # leave for config validation def cluster_params params.permit(*cluster_params_keys) end def cluster_params_keys [:name, :description, :version] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kafka_command-0.0.3 | app/controllers/kafka_command/clusters_controller.rb |
kafka_command-0.0.2 | app/controllers/kafka_command/clusters_controller.rb |