Class: Adminpanel::GalleriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Adminpanel::GalleriesController
- Defined in:
- app/controllers/adminpanel/galleries_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 15 def create @gallery = Gallery.new(params[:gallery]) if @gallery.save redirect_to gallery_path(@gallery), :notice => "La imagen ha sido creada" else render 'new' end end |
#destroy ⇒ Object
25 26 27 28 29 30 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 25 def destroy @gallery = Gallery.find(params[:id]) @gallery.destroy redirect_to galleries_path, :notice => "La imagen ha sido eliminada" end |
#edit ⇒ Object
11 12 13 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 11 def edit @gallery = Gallery.find(params[:id]) end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 3 def index @galleries = Gallery.all end |
#new ⇒ Object
41 42 43 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 41 def new @gallery = Gallery.new end |
#show ⇒ Object
7 8 9 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 7 def show @gallery = Gallery.find(params[:id]) end |
#update ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 32 def update @gallery = Gallery.find(params[:id]) if @gallery.update_attributes(params[:gallery]) redirect_to gallery_path(@gallery) else render 'edit' end end |