Sha256: 1b5d99d2d7110b2173a6d2baef160da899e248ef5db895e0bac811931cd18095

Contents?: true

Size: 1017 Bytes

Versions: 8

Compression:

Stored size: 1017 Bytes

Contents

class Article < ActiveRecord::Base
  # With default error messages.
  validates_presence_of :title
  validates_length_of :description, :minimum => 10

  # With your own message with L10n. 
  # old style(Backward compatibility).
  # blog.po in RAILS_ROOT/po/*/ is used.
#  validates_presence_of :title, :message => N_("can't be empty")
#  validates_length_of :description, :minimum => 10, :message => N_("is too short (min is %d characters)")

  # new style (you can use %{fn} and %d freely in the message)
  # blog.po in RAILS_ROOT/po/*/ is used.
#  validates_presence_of :title, :message => N_("%{fn} can't be empty!")
#  validates_length_of :description, :minimum => 10, :message => N_("%{fn} is too short (min is %d characters)")

# you can also redefined the title/explanation of the top of the error message.
#
#  set_error_message_title(N_("An error is occured on %{record}"), 
#			  N_("%{num} errors are occured on %{record}"))
#  set_error_message_explanation(N_("The error is:"), N_("The errors are:"))
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gettext-1.6.0-mswin32 samples/rails/app/models/article.rb
gettext-1.5.0-mswin32 samples/rails/app/models/article.rb
gettext-1.4.0-mswin32 samples/rails/app/models/article.rb
gettext-1.3.0-mswin32 samples/rails/app/models/article.rb
gettext-1.3.0 samples/rails/app/models/article.rb
gettext-1.4.0 samples/rails/app/models/article.rb
gettext-1.5.0 samples/rails/app/models/article.rb
gettext-1.6.0 samples/rails/app/models/article.rb