Sha256: 34b3b7ad274572178fb18586cfbf85b2a1e75791b075397b7ade58f066e5653c
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
module Commontator class SubscriptionsController < ApplicationController before_filter :get_thread, :except => :index # GET /subscriptions def index @threads = Subscription.find_all_by_subscriber_id(@commontator.id)\ .collect { |cts| cts.thread } end # POST /1/subscribe def create raise SecurityTransgression unless @thread.can_subscribe?(@commontator) if !@thread.subscribe(@commontator) flash[:alert] = "You are already subscribed to this " + commontable_name(@thread) end respond_to do |format| format.html { redirect_to @thread } format.js end end # POST /1/unsubscribe def destroy raise SecurityTransgression unless @thread.can_subscribe?(@commontator) if !@thread.unsubscribe(@commontator) flash[:alert] = "You are not subscribed to this " + commontable_name(@thread) end respond_to do |format| format.html { redirect_to @thread } format.js end end end end
Version data entries
3 entries across 3 versions & 1 rubygems