Class: Workarea::Admin::SegmentRulesController
Instance Method Summary
collapse
#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
#most_visited
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/workarea/admin/segment_rules_controller.rb', line 15
def create
if @rule.save
flash[:success] = t('workarea.admin.segment_rules.flash_messages.saved')
redirect_to return_to || segment_rules_path(@segment)
else
flash[:error] = t('workarea.admin.segment_rules.flash_messages.error')
render :index, status: :unprocessable_entity
end
end
|
#destroy ⇒ Object
35
36
37
38
39
|
# File 'app/controllers/workarea/admin/segment_rules_controller.rb', line 35
def destroy
@rule.destroy
flash[:success] = t('workarea.admin.segment_rules.flash_messages.destroyed')
redirect_to return_to || segment_rules_path(@segment)
end
|
#geolocation_options ⇒ Object
11
12
13
|
# File 'app/controllers/workarea/admin/segment_rules_controller.rb', line 11
def geolocation_options
@results = Segment::Rules::GeolocationOption.search(params[:q])
end
|
#index ⇒ Object
8
9
|
# File 'app/controllers/workarea/admin/segment_rules_controller.rb', line 8
def index
end
|
#update ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/workarea/admin/segment_rules_controller.rb', line 25
def update
if @rule.update_attributes(params[:rule])
flash[:success] = t('workarea.admin.segment_rules.flash_messages.saved')
redirect_to return_to || segment_rules_path(@segment)
else
flash[:error] = t('workarea.admin.segment_rules.flash_messages.error')
render :edit, status: :unprocessable_entity
end
end
|