Sha256: 42bb462815caec116095246daab3f3e178241785b928eb1062a0f610863c8f10

Contents?: true

Size: 1.96 KB

Versions: 38

Compression:

Stored size: 1.96 KB

Contents

class ArticlesController < ApplicationController
  before_filter :authenticate_user!

  # GET /articles
  # GET /articles.json
  def index
    @articles = Article.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @articles }
    end
  end

  # GET /articles/1
  # GET /articles/1.json
  def show
    @article = Article.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @article }
    end
  end

  # GET /articles/new
  # GET /articles/new.json
  def new
    @article = Article.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @article }
    end
  end

  # GET /articles/1/edit
  def edit
    @article = Article.find(params[:id])
  end

  # POST /articles
  # POST /articles.json
  def create
    @article = Article.new(params[:article])

    respond_to do |format|
      if @article.save
        format.html { redirect_to @article, notice: 'Article was successfully created.' }
        format.json { render json: @article, status: :created, location: @article }
      else
        format.html { render action: "new" }
        format.json { render json: @article.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /articles/1
  # PUT /articles/1.json
  def update
    @article = Article.find(params[:id])

    respond_to do |format|
      if @article.update_attributes(params[:article])
        format.html { redirect_to @article, notice: 'Article was successfully updated.' }
        format.json { head :ok }
      else
        format.html { render action: "edit" }
        format.json { render json: @article.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /articles/1
  # DELETE /articles/1.json
  def destroy
    @article = Article.find(params[:id])
    @article.destroy

    respond_to do |format|
      format.html { redirect_to articles_url }
      format.json { head :ok }
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
translation_center-1.7.2 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.8.4 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.8.3 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.8.2 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.8.1 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.8.0 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.7.9 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.7.8 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-0.0.0 test/dummy/app/controllers/articles_controller.rb
afalkear_translation_center-1.7.7 test/dummy/app/controllers/articles_controller.rb
translation_center-1.7.1 test/dummy/app/controllers/articles_controller.rb
translation_center-1.7.0 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.10 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.9 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.8 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.7 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.6 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.5 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.4 test/dummy/app/controllers/articles_controller.rb
translation_center-1.6.3 test/dummy/app/controllers/articles_controller.rb