Class: OfficersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/officers_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_navable, #current_navable=, #current_user, #point_navigation_to, #redirect_www_subdomain, #set_locale

Instance Method Details

#create_officers_groupObject

Required params:

- group_id or page_id
- name


7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/officers_controller.rb', line 7

def create_officers_group
  @structureable = secure_structureable
  authorize! :create_officers_group_for, @structureable
  
  @officers_group = @structureable.officers_parent.child_groups.create name: params[:name]
  
  respond_to do |format|
    format.html { redirect_to @structureable }
    format.json { render json: @officers_group.attributes.merge({
      officers_group_entry_html: render_to_string(partial: 'officers/officers_group_entry', formats: [:html], handlers: [:haml], layout: false, locals: {officer_group: @officers_group, structureable: @structureable})
    })}
  end
end