Sha256: 5fb1b5b83b695745aa1bde557e1675a865818c7a83304fc500bd821364424195

Contents?: true

Size: 649 Bytes

Versions: 6

Compression:

Stored size: 649 Bytes

Contents

class GreenFlag::Admin::RuleListsController < ApplicationController

  def show
    feature_id = params[:feature_id]
    feature = GreenFlag::Feature.find(feature_id)
    rules = feature.rules

    render :json => rules.to_json(methods: :group_description)
  end

  def update
    feature_id = params[:feature_id].to_i
    rule_array = params['_json'] || []

    filter_rules(rule_array)

    rules = GreenFlag::Rule.set_rules!(feature_id, rule_array)
    render :json => rules.to_json(methods: :group_description)
  end

private

  def filter_rules(rule_array)
    rule_array.each do |rule|
      rule.delete('group_description')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
green_flag-0.4.0 app/controllers/green_flag/admin/rule_lists_controller.rb
green_flag-0.3.0 app/controllers/green_flag/admin/rule_lists_controller.rb
green_flag-0.2.0 app/controllers/green_flag/admin/rule_lists_controller.rb
green_flag-0.1.2 app/controllers/green_flag/admin/rule_lists_controller.rb
green_flag-0.1.1 app/controllers/green_flag/admin/rule_lists_controller.rb
green_flag-0.1.0 app/controllers/green_flag/admin/rule_lists_controller.rb