Class: Adminpanel::SectionsController

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

Instance Method Summary collapse

Methods included from TwitterActions

#twitter_publish

Methods included from FacebookActions

#fb_choose_page, #fb_publish, #fb_save_token

Methods included from GalleryzableActions

#move_better, #move_worst

Methods included from RestActions

#create, #destroy, #new

Methods included from SessionsHelper

#current_user, #current_user=, #sign_in, #sign_out, #signed_in?

Instance Method Details

#editObject

def new

@section = Section.new
authorize! :create, @section

end



8
9
10
11
12
13
14
# File 'app/controllers/adminpanel/sections_controller.rb', line 8

def edit
  @section = Section.find(params[:id])
  # respond_to do |format|
    # format.html
    # format.json {render :json => {:section => @section }}
  # end
end

#indexObject

redirect_to sections_path end



37
38
39
# File 'app/controllers/adminpanel/sections_controller.rb', line 37

def index
  @sections = Section.all
end

#showObject



26
27
28
# File 'app/controllers/adminpanel/sections_controller.rb', line 26

def show
  @section = Section.find(params[:id])
end

#updateObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/adminpanel/sections_controller.rb', line 16

def update
  @section = Section.find(params[:id])

  if @section.update_attributes(params[:section])
    redirect_to section_path(@section), :notice => 'La seccion se ha actualizado'
  else
    render 'edit'
  end
end