Class | Admin::OrganizationsController
In: | app/controllers/admin/organizations_controller.rb
Parent: | Admin::BaseController

### Methods

create destroy edit index new show update

### Public Instance methods

create()

POST /admin_organizations POST /admin_organizations.xml

[Source]

        # File app/controllers/admin/organizations_controller.rb, line 42
    42:   def create
    43:     @organization = Organization.new(params[:organization])
    44:
    45:     respond_to do |format|
    46:       if @organization.save
    47:         flash[:notice] = 'El organismo se ha creado correctamente.'
    48:         format.html { redirect_to(admin_organization_path(@organization)) }
    49:         format.xml  { render :xml => @organization, :status => :created, :location => @organization }
    50:       else
    51:         format.html { render :action => "new" }
    52:         format.xml  { render :xml => @organization.errors, :status => :unprocessable_entity }
    53:       end
    54:     end
    55:   end

destroy()

DELETE /admin_organizations/1 DELETE /admin_organizations/1.xml

[Source]

        # File app/controllers/admin/organizations_controller.rb, line 76
    76:   def destroy
    77:     @organization = Organization.find(params[:id])
    78:     @organization.destroy
    79:
    80:     respond_to do |format|
    81:       format.html { redirect_to(admin_organizations_url) }
    82:       format.xml  { head :ok }
    83:     end
    84:   end

edit()

GET /admin_organizations/1/edit

[Source]

        # File app/controllers/admin/organizations_controller.rb, line 36
    36:   def edit
    37:     @organization = Organization.find(params[:id])
    38:   end

index()

GET /admin_organizations GET /admin_organizations.xml

[Source]

        # File app/controllers/admin/organizations_controller.rb, line 4
     4:   def index
     5:     @organizations = Organization.find(:all, :conditions => "parent_id IS NULL", :order => "position")
     6:
     7:     respond_to do |format|
     8:       format.html # index.html.erb
     9:       format.xml  { render :xml => @admin_organizations }
    10:     end
    11:   end

new()

GET /admin_organizations/new GET /admin_organizations/new.xml

[Source]

        # File app/controllers/admin/organizations_controller.rb, line 26
    26:   def new
    27:     @organization = Organization.new
    28:
    29:     respond_to do |format|
    30:       format.html # new.html.erb
    31:       format.xml  { render :xml => @organization }
    32:     end
    33:   end

show()

GET /admin_organizations/1 GET /admin_organizations/1.xml

[Source]

        # File app/controllers/admin/organizations_controller.rb, line 15
    15:   def show
    16:     @organization = Organization.find(params[:id])
    17:
    18:     respond_to do |format|
    19:       format.html # show.html.erb
    20:       format.xml  { render :xml => @organization }
    21:     end
    22:   end

update()

PUT /admin_organizations/1 PUT /admin_organizations/1.xml

[Source]

        # File app/controllers/admin/organizations_controller.rb, line 59
    59:   def update
    60:     @organization = Organization.find(params[:id])
    61:
    62:     respond_to do |format|
    63:       if @organization.update_attributes(params[:organization])
    64:         flash[:notice] = 'El organismo se ha actualizado correctamente.'
    65:         format.html { redirect_to(admin_organization_path(@organization)) }
    66:         format.xml  { head :ok }
    67:       else
    68:         format.html { render :action => "edit" }
    69:         format.xml  { render :xml => @organization.errors, :status => :unprocessable_entity }
    70:       end
    71:     end
    72:   end

[Validate]