Sha256: 598a152d3c52ec3642238527c2d994b8eebacf7d3406e944f0e0bae10c2eac20
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
module Commontator class SubscriptionsController < ApplicationController include ThreadsHelper 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