Sha256: 3eb81de83224db0e033f2357628b5fa79ef29b8ec195d5c29c1149ebe9683a29

Contents?: true

Size: 684 Bytes

Versions: 8

Compression:

Stored size: 684 Bytes

Contents

class MonitorshipsController < BaseController
  before_filter :login_required

  def create
    @monitorship = Monitorship.find_or_initialize_by_user_id_and_topic_id(current_user.id, params[:topic_id])
    @monitorship.update_attribute :active, true
    respond_to do |format| 
      format.html { redirect_to forum_topic_path(params[:forum_id], params[:topic_id]) }
      format.js
    end
  end
  
  def destroy
    Monitorship.update_all ['active = ?', false], ['user_id = ? and topic_id = ?', current_user.id, params[:topic_id]]
    respond_to do |format| 
      format.html { redirect_to forum_topic_path(params[:forum_id], params[:topic_id]) }
      format.js
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
community_engine-2.3.2 app/controllers/monitorships_controller.rb
community_engine-2.3.1 app/controllers/monitorships_controller.rb
community_engine-2.3.0 app/controllers/monitorships_controller.rb
community_engine-2.1.0 app/controllers/monitorships_controller.rb
community_engine-2.0.0 app/controllers/monitorships_controller.rb
community_engine-2.0.0.beta3 app/controllers/monitorships_controller.rb
community_engine-2.0.0.beta2 app/controllers/monitorships_controller.rb
community_engine-2.0.0.beta1 app/controllers/monitorships_controller.rb