diaspora/app/controllers/bookmarks_controller.rb
2010-06-14 20:20:19 -07:00

46 lines
1 KiB
Ruby

class BookmarksController < ApplicationController
before_filter :authenticate_user!
def index
@bookmarks = Bookmark.all
end
def edit
@bookmark = Bookmark.first(:conditions => {:id => params[:id]})
end
def update
@bookmark = Bookmark.first(:conditions => {:id => params[:id]})
if @bookmark.update_attributes(params[:bookmark])
flash[:notice] = "Successfully updated bookmark."
redirect_to @bookmark
else
render :action => 'edit'
end
end
def show
@bookmark = Bookmark.first(:conditions => {:id => params[:id]})
end
def create
@bookmark = Bookmark.new(params[:bookmark])
if @bookmark.save
flash[:notice] = "Successfully created bookmark."
redirect_to @bookmark
else
render :action => 'new'
end
end
def new
@bookmark = Bookmark.new
end
def destroy
@bookmark = Bookmark.first(:conditions => {:id => params[:id]})
@bookmark.destroy
flash[:notice] = "Successfully destroyed bookmark."
redirect_to bookmarks_url
end
end