Class | Admin::IconsController
In: | app/controllers/admin/icons_controller.rb
Parent: | Admin::BaseController

### Methods

create destroy edit index new show update

### Public Instance methods

create()

[Source]

        # File app/controllers/admin/icons_controller.rb, line 25
    25:   def create
    26:     @icon = Icon.new(params[:icon])
    27:     if @icon.save
    28:       flash[:notice] = 'El icono se ha guardado correctamente'
    29:       redirect_to admin_icon_path(@icon)
    30:     else
    31:       render :action => 'new'
    32:     end
    33:   end

destroy()

[Source]

        # File app/controllers/admin/icons_controller.rb, line 45
    45:   def destroy
    46:     @icon = Icon.find(params[:id])
    47:     if @icon.destroy
    48:       flash[:notice] = 'El icono se ha eliminado correctamente'
    49:       redirect_to admin_icons_path
    50:     else
    51:       flash[:error] = 'El icono no se ha podido eliminar'
    52:       redirect_to admin_icon_path(@icon)
    53:     end
    54:   end

edit()

[Source]

        # File app/controllers/admin/icons_controller.rb, line 20
    20:   def edit
    21:     @icon = Icon.find(params[:id])
    22:     @title = 'Modificar icono'
    23:   end

index()

[Source]

       # File app/controllers/admin/icons_controller.rb, line 5
    5:   def index
    6:     @title = 'Iconos'
    7:     @icons = Icon.paginate :page => params[:page], :order => "created_at DESC"
    8:   end

new()

[Source]

        # File app/controllers/admin/icons_controller.rb, line 15
    15:   def new
    16:     @icon = Icon.new
    17:     @title = 'Nuevo icono'
    18:   end

show()

[Source]

        # File app/controllers/admin/icons_controller.rb, line 10
    10:   def show
    11:     @icon = Icon.find(params[:id])
    12:     @title = @icon.name
    13:   end

update()

[Source]

        # File app/controllers/admin/icons_controller.rb, line 35
    35:   def update
    36:     @icon = Icon.find(params[:id])
    37:     if @icon.update_attributes(params[:icon])
    38:       flash[:notice] = 'El icon se ha guardado correctamente'
    39:       redirect_to admin_icon_path(@icon)
    40:     else
    41:       render :action => 'edit'
    42:     end
    43:   end

[Validate]