Class: PhotosController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PhotosController
- Defined in:
- app/controllers/photos_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/photos_controller.rb', line 14 def create @photo = Photo.new(params[:photo]) @photo.save! redirect_to @photo rescue ActiveRecord::RecordInvalid flash.now[:error] = "Error" render :action => 'new' end |
#destroy ⇒ Object
31 32 33 34 |
# File 'app/controllers/photos_controller.rb', line 31 def destroy @photo.destroy redirect_to photos_path end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/photos_controller.rb', line 6 def index @photos = Photo.all end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/photos_controller.rb', line 10 def new @photo = Photo.new end |
#update ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/controllers/photos_controller.rb', line 23 def update @photo.update_attributes!(params[:photo]) redirect_to @photo rescue ActiveRecord::RecordInvalid flash.now[:error] = "Error" render :action => 'edit' end |