Sha256: 2e34ecf0928b38d7b768dee7754658d81b448015006182a6c05516cf101f9730
Contents?: true
Size: 1.22 KB
Versions: 2
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gettext-1.1.0-mswin32 | samples/rails/app/controllers/blog_controller.rb |
gettext-1.1.0 | samples/rails/app/controllers/blog_controller.rb |