Sha256: e897c3aa0d0c17d6a2a8a5523f667f753553e140ab577802400ee23c7859b908
Contents?: true
Size: 881 Bytes
Versions: 1
Compression:
Stored size: 881 Bytes
Contents
class TopicsController < ApplicationController # GET /topic/:name # GET /topic/:name.json def show @messages = Message.topic_of(topic) end # POST /topic/:name/subscribe # POST /topic/:name/subscribe.json def subscribe respond_to do |format| if UserSubscribeTopic.create(topic: topic, user: current_user) format.html { redirect_to topic_path(topic), notice: "You are subscribe it." } else format.html { render :index } end end end # DELETE /topic/:name/subscribe # DELETE /topic/:name/subscribe.json def unsubscribe UserSubscribeTopic.find_by(topic: params[:id], user: current_user).destroy respond_to do |format| format.html { redirect_to topic_path(topic), notice: "You are unsubscribe it." } format.json { head :no_content } end end private def topic params[:id] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Xwitter-0.4.0 | app/controllers/topics_controller.rb |