Sha256: f0232e2dd99d2fb2d4327b3566956c18714baa236f03cece8569675308827f18

Contents?: true

Size: 1.22 KB

Versions: 32

Compression:

Stored size: 1.22 KB

Contents

class TopicsController < ApplicationController
  include Auth::Concerns::TokenConcern
  respond_to :html, :json
  before_action :set_topic, only: [:show, :edit, :update, :destroy]

  # GET /topics
  def index
    #redirect_to "http://www.google.com"
    
    @topics = Topic.all
  end

  # GET /topics/1
  def show
  end

  # GET /topics/new
  def new
    @topic = Topic.new
    respond_with @topic
  end

  # GET /topics/1/edit
  def edit
  end

  # POST /topics
  def create
    @topic = Topic.new(topic_params)

    if @topic.save
      redirect_to @topic, notice: 'Topic was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /topics/1
  def update
    if @topic.update(topic_params)
      redirect_to @topic, notice: 'Topic was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /topics/1
  def destroy
    @topic.destroy
    redirect_to topics_url, notice: 'Topic was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_topic
      @topic = Topic.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def topic_params
      params.require(:topic).permit(:name, :place)
    end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
wordjelly-auth-1.3.3 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.3.2 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.3.1 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.3.0 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.9 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.8 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.6 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.5 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.4 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.3 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.2 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.1 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.2.0 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.1.9 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.1.8 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.1.7 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.1.6 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.1.5 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.1.4 spec/dummy/app/controllers/topics_controller.rb
wordjelly-auth-1.1.3 spec/dummy/app/controllers/topics_controller.rb