Ruby on Rails での入力の検証方法について書く。世の中にあまねくRailsのページによると、以下のような感じで入力を検証するのがRails流らしい。 # モデルクラス。 class Hoge < ActiveRecord::Base validates_length_of :name, :maximum => 30 end # コントローラ class HogeController < ApplicationController # アクション。新しいHogeを作成する。 def create @hoge = Hoge.new(params[:hoge]) if @hoge.save redirect_to :action => :list else render :action => :new end end end ユーザがフォームに適当に入力してボタンを押すと、コントロー