MS IZ removed the views and redirected the edit route

This commit is contained in:
maxwell 2010-09-13 12:20:47 -07:00
parent 27f1b29581
commit 24d957cb32
4 changed files with 6 additions and 2 deletions

View file

@ -34,6 +34,7 @@ class AlbumsController < ApplicationController
def edit def edit
@album = Album.find_by_id params[:id] @album = Album.find_by_id params[:id]
redirect_to @album unless current_user.owns? @album
end end
def update def update

View file

@ -71,6 +71,8 @@ class PhotosController < ApplicationController
def edit def edit
@photo = Photo.find_by_id params[:id] @photo = Photo.find_by_id params[:id]
@album = @photo.album @album = @photo.album
redirect_to @photo unless current_user.owns? @album
end end
def update def update

View file

@ -6,7 +6,7 @@
%ul#stream %ul#stream
- for post in @posts - for post in @posts
= render type_partial(post), :post => post = render type_partial(post), :post => post unless post.class == Album
#pagination #pagination
= will_paginate @posts = will_paginate @posts

View file

@ -21,7 +21,8 @@
= @photo.image = @photo.image
.right .right
= link_to 'Edit Photo', edit_photo_path(@photo), :class => "button" -if current_user.owns? @album
= link_to 'Edit Photo', edit_photo_path(@photo), :class => "button"
.sub_header .sub_header
= link_to "<< prev", url_to_prev(@photo, @album) = link_to "<< prev", url_to_prev(@photo, @album)