Class: GreenFlag::Admin::RuleListsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/green_flag/admin/rule_lists_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
# File 'app/controllers/green_flag/admin/rule_lists_controller.rb', line 3

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

#updateObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/green_flag/admin/rule_lists_controller.rb', line 11

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