Class: Adminpanel::SectionsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#get_menu_elements, #handle_unverified_request, #set_model, #signed_in_user

Methods included from RouterHelper

#adminpanel_resources, #default_controllers, #find_resources, #menu_items, #resources_path

Methods included from RestActionsHelper

#create, #destroy

Methods included from SessionsHelper

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

Instance Method Details

#editObject

if @section.save

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

end



17
18
19
# File 'app/controllers/adminpanel/sections_controller.rb', line 17

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

#indexObject

redirect_to sections_path end



42
43
44
# File 'app/controllers/adminpanel/sections_controller.rb', line 42

def index
  @sections = Section.all
end

#newObject



3
4
5
# File 'app/controllers/adminpanel/sections_controller.rb', line 3

def new
  @section = Section.new
end

#showObject



31
32
33
# File 'app/controllers/adminpanel/sections_controller.rb', line 31

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

#updateObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/adminpanel/sections_controller.rb', line 21

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