Sha256: abf852bbf1f48914c787dcd0ed613d1d283259dc0bc4019f76b574dec30a4d77

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

module ContentEngine
  class ArticlesController < ContentEngineController
    respond_to :html, :xml
  
    # GET /articles
    # GET /articles.xml
    def index
      @articles = @site.articles.order('created_at desc').all.paginate(:page => params[:page])
      respond_with @articles
    end

    # GET /articles/1
    # GET /articles/1.xml
    def show
      respond_with @article = @site.articles.find(params[:id])
    end

    # GET /articles/new
    # GET /articles/new.xml
    def new
      respond_with @article = @site.articles.new
    end

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

    # POST /articles
    # POST /articles.xml
    def create
      @article = @site.articles.new(params[:article])
      flash[:notice] = "Article was successfully created." if @article.save
      respond_with @article
    end

    # PUT /articles/1
    # PUT /articles/1.xml
    def update
      @article = @site.articles.find(params[:id])
      flash[:notice] = "Article was successfully updated." if @article.update_attributes(params[:article])
      respond_with @article
    end

    # DELETE /articles/1
    # DELETE /articles/1.xml
    def destroy
      @article = @site.articles.find(params[:id])
      @article.destroy
    
      respond_with @article
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
content_engine-0.1.0 app/controllers/content_engine/articles_controller.rb