Class: OrganizationsController
Instance Method Summary
collapse
included
#current_ability
#parent, #voluntary_application_javascripts, #voluntary_application_stylesheets
included
Instance Method Details
#create ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/organizations_controller.rb', line 29
def create
@organization = current_user.organizations.new(params[:organization])
if @organization.save
redirect_to @organization, notice: t('general.form.successfully_created')
else
render :new
end
end
|
#destroy ⇒ Object
50
51
52
53
|
# File 'app/controllers/organizations_controller.rb', line 50
def destroy
@organization.destroy
redirect_to organizations_url, notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
39
40
|
# File 'app/controllers/organizations_controller.rb', line 39
def edit
end
|
#index ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/organizations_controller.rb', line 12
def index
@parent = find_parent Organization::PARENT_TYPES
@organizations = @parent ? @parent.organizations.order(:name) : Organization.order(:name)
respond_to do |format|
format.html
format.json { render json: @organizations.tokens(params[:q]) }
end
end
|
#new ⇒ Object
25
26
27
|
# File 'app/controllers/organizations_controller.rb', line 25
def new
@organization = Organization.new
end
|
#resource ⇒ Object
55
56
57
|
# File 'app/controllers/organizations_controller.rb', line 55
def resource
@organization
end
|
#show ⇒ Object
22
23
|
# File 'app/controllers/organizations_controller.rb', line 22
def show
end
|
#update ⇒ Object
42
43
44
45
46
47
48
|
# File 'app/controllers/organizations_controller.rb', line 42
def update
if @organization.update_attributes(params[:organization])
redirect_to @organization, notice: t('general.form.successfully_updated')
else
render :edit
end
end
|