app/controllers/adminpanel/sections_controller.rb in adminpanel-2.2.5 vs app/controllers/adminpanel/sections_controller.rb in adminpanel-2.3.0
- old
+ new
@@ -1,7 +1,11 @@
module Adminpanel
class SectionsController < Adminpanel::ApplicationController
+ def index
+ @sections = Section.all
+ end
+
# def new
# @section = Section.new
# authorize! :create, @section
# end
@@ -14,41 +18,37 @@
end
def update
@section = Section.find(params[:id])
- if @section.update_attributes(params[:section])
- redirect_to section_path(@section), :notice => 'La seccion se ha actualizado'
+ if @section.update(section_params)
+ redirect_to section_path(@section), notice: 'La seccion se ha actualizado'
else
render 'edit'
end
end
def show
@section = Section.find(params[:id])
end
- # def destroy
- # @section = Section.find(params[:id])
- # @section.destroy
-
- # redirect_to sections_path
- # end
-
- def index
- @sections = Section.all
- end
-
private
def section_params
params.require(:section).permit(
:has_description,
:description,
:key,
:page,
:name,
+ :max_files,
:has_image,
- { images_attributes: [:id, :file, :_destroy] }
+ {
+ sectionfiles_attributes: [
+ :id,
+ :file,
+ :_destroy
+ ]
+ }
)
end
end
end