Class: GalleriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- GalleriesController
- Defined in:
- app/controllers/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
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/galleries_controller.rb', line 20 def create @gallery = Gallery.new(params[:gallery]) if @gallery.save flash[:notice] = "Successfully created gallery." redirect_to @gallery else render :action => 'new' end end |
#destroy ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/galleries_controller.rb', line 44 def destroy @gallery = Gallery.find(params[:id]) @gallery.destroy flash[:notice] = "Successfully destroyed gallery." redirect_to galleries_url end |
#edit ⇒ Object
30 31 32 |
# File 'app/controllers/galleries_controller.rb', line 30 def edit @gallery = Gallery.find(params[:id]) end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/galleries_controller.rb', line 5 def index @galleries = Gallery.all end |
#new ⇒ Object
15 16 17 18 |
# File 'app/controllers/galleries_controller.rb', line 15 def new @gallery = Gallery.new @gallery.build_index end |
#show ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/galleries_controller.rb', line 9 def show @gallery = Gallery.find(params[:id]) @index = @gallery.index @photo = @gallery.photos.first end |
#update ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/galleries_controller.rb', line 34 def update @gallery = Gallery.find(params[:id]) if @gallery.update_attributes(params[:gallery]) flash[:notice] = "Successfully updated gallery." redirect_to @gallery else render :action => 'edit' end end |