Class: Adminpanel::SectionsController

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

Instance Method Summary collapse

Instance Method Details

#edit ⇒ Object

if @section.save redirect_to section_path(@section), :notice => 'La seccion ha sido creada' else render 'new' end end



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

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

#index ⇒ Object

redirect_to sections_path end



48
49
50
# File 'app/controllers/adminpanel/sections_controller.rb', line 48

def index
  @sections = Section.all
end

#new ⇒ Object



5
6
7
# File 'app/controllers/adminpanel/sections_controller.rb', line 5

def new
  @section = Section.new
end

#show ⇒ Object



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

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

#update ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'app/controllers/adminpanel/sections_controller.rb', line 27

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