Class: Detour::FlaggableFlagsController

Inherits:
ApplicationController show all
Includes:
FlaggableFlagsHelper
Defined in:
app/controllers/detour/flaggable_flags_controller.rb

Instance Method Summary collapse

Methods included from FlaggableFlagsHelper

#feature_name, #flag_noun, #flag_title, #flag_type, #flag_verb, #flaggable_type

Instance Method Details

#indexObject



8
9
10
# File 'app/controllers/detour/flaggable_flags_controller.rb', line 8

def index
  @feature = Detour::Feature.find_by_name!(params[:feature_name])
end

#updateObject



12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/detour/flaggable_flags_controller.rb', line 12

def update
  @feature = Detour::Feature.find_by_name!(params[:feature_name])

  if @feature.update_attributes(params[:feature])
    flash[:notice] = "Your #{flag_noun.pluralize} have been updated"
    redirect_to send("#{flag_type}_flags_path", feature_name: params[:feature_name], flaggable_type: params[:flaggable_type])
  else
    render :index
  end
end