+ rescue ActiveRecord::RecordNotFound
+ render :action => "no_such_entry", :status => :not_found
+ end
+
+ def subscribe
+ diary_entry = DiaryEntry.find(params[:id])
+
+ diary_entry.subscriptions.create(:user => @user) unless diary_entry.subscribers.exists?(@user.id)
+
+ redirect_to :controller => "diary_entry", :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id
+ rescue ActiveRecord::RecordNotFound
+ render :action => "no_such_entry", :status => :not_found
+ end
+
+ def unsubscribe
+ diary_entry = DiaryEntry.find(params[:id])
+
+ diary_entry.subscriptions.where(:user => @user).delete_all if diary_entry.subscribers.exists?(@user.id)
+
+ redirect_to :controller => "diary_entry", :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id
+ rescue ActiveRecord::RecordNotFound
+ render :action => "no_such_entry", :status => :not_found