Sha256: cee1bcb600f663d88f63859be89c3ed20dce7b82849f0f74e34a86d698551edd

Contents?: true

Size: 1.22 KB

Versions: 20

Compression:

Stored size: 1.22 KB

Contents

# blog_controller.rb - a sample script for Ruby on Rails
#
# Copyright (C) 2005 Masao Mutoh
#
# This file is distributed under the same license as Ruby-GetText-Package.

class BlogController < ApplicationController
  # If you want to have textdomains each as controllers.
  # You need to bind textdomain here.

  #init_gettext "blog"

  def index
    list
    render :action => 'list'
  end

  def list
    @articles = Article.find(:all, :order => 'lastupdate desc, id desc')
  end

  def show
    @article = Article.find(params[:id])
  end

  def new
    @article = Article.new
  end

  def create
    @article = Article.new(params[:article])
    if @article.save
      flash[:notice] = _('Article was successfully created.')
      redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end

  def edit
    @article = Article.find(params[:id])
  end

  def update
    @article = Article.find(params[:id])
    if @article.update_attributes(params[:article])
      flash[:notice] = _('Article was successfully updated.')
      redirect_to :action => 'show', :id => @article
    else
      render :action => 'edit'
    end
  end

  def destroy
    Article.find(params[:id]).destroy
    redirect_to :action => 'list'
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
gettext-1.10.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.9.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.8.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.7.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.6.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.5.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.4.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.3.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.2.0-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.1.1-mswin32 samples/rails/app/controllers/blog_controller.rb
gettext-1.1.1 samples/rails/app/controllers/blog_controller.rb
gettext-1.2.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.10.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.5.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.3.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.4.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.8.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.6.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.7.0 samples/rails/app/controllers/blog_controller.rb
gettext-1.9.0 samples/rails/app/controllers/blog_controller.rb