Class | Admin::TreesController
In: | app/controllers/admin/trees_controller.rb
Parent: | Admin::BaseController

### Methods

create destroy edit index new show update

### Public Instance methods

create()

POST /trees POST /trees.xml

[Source]

        # File app/controllers/admin/trees_controller.rb, line 52
    52:   def create
    53:     @tree = Tree.new(params[:tree])
    54:     set_current_tab
    55:     respond_to do |format|
    56:       if @tree.save
    57:         flash[:notice] = 'Tree was successfully created.'
    58:         format.html { redirect_to(admin_tree_url(@tree)) }
    59:         format.xml  { render :xml => @tree, :status => :created, :location => @tree }
    60:       else
    61:         format.html { render :action => "new" }
    62:         format.xml  { render :xml => @tree.errors, :status => :unprocessable_entity }
    63:       end
    64:     end
    65:   end

destroy()

DELETE /trees/1 DELETE /trees/1.xml

[Source]

        # File app/controllers/admin/trees_controller.rb, line 87
    87:   def destroy
    88:     @tree = Tree.find(params[:id])
    89:     @tree.destroy
    90:     set_current_tab
    91:
    92:     respond_to do |format|
    93:       format.html { redirect_to(admin_trees_url) }
    94:       format.xml  { head :ok }
    95:     end
    96:   end

edit()

GET /trees/1/edit

[Source]

        # File app/controllers/admin/trees_controller.rb, line 44
    44:   def edit
    45:     @tree = Tree.find(params[:id])
    46:     @title = "Modificar #{@tree.name_es}"
    47:     set_current_tab
    48:   end

index()

GET /trees GET /trees.xml

[Source]

        # File app/controllers/admin/trees_controller.rb, line 9
     9:   def index
    10:     @trees = Tree.find(:all)
    11:     @title = 'Categorías'
    12:     set_current_tab
    13:     respond_to do |format|
    14:       format.html # index.html.erb
    15:       format.xml  { render :xml => @trees }
    16:     end
    17:   end

new()

GET /trees/new GET /trees/new.xml

[Source]

        # File app/controllers/admin/trees_controller.rb, line 33
    33:   def new
    34:     @tree = Tree.new
    35:     @title = 'Nueva sección'
    36:     set_current_tab
    37:     respond_to do |format|
    38:       format.html # new.html.erb
    39:       format.xml  { render :xml => @tree }
    40:     end
    41:   end

show()

GET /trees/1 GET /trees/1.xml

[Source]

        # File app/controllers/admin/trees_controller.rb, line 21
    21:   def show
    22:     @tree = Tree.find(params[:id])
    23:     @title = "#{@tree.name_es} / #{@tree.name_eu}"
    24:     set_current_tab
    25:     respond_to do |format|
    26:       format.html # show.html.erb
    27:       format.xml  { render :xml => @tree }
    28:     end
    29:   end

update()

PUT /trees/1 PUT /trees/1.xml

[Source]

        # File app/controllers/admin/trees_controller.rb, line 69
    69:   def update
    70:     @tree = Tree.find(params[:id])
    71:     set_current_tab
    72:
    73:     respond_to do |format|
    74:       if @tree.update_attributes(params[:tree])
    75:         flash[:notice] = 'Tree was successfully updated.'
    76:         format.html { redirect_to(admin_tree_url(@tree)) }
    77:         format.xml  { head :ok }
    78:       else
    79:         format.html { render :action => "edit" }
    80:         format.xml  { render :xml => @tree.errors, :status => :unprocessable_entity }
    81:       end
    82:     end
    83:   end

[Validate]