Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- before_filter :check_ownership, :except => [:index, :show]
- def check_ownership
- @book = Book.find(params[:id])
- if @book.user_id != current_user.id
- redirect_to(books_path, :notice=>"No es tuyo!")
- end
- end
Add Comment
Please, Sign In to add comment