jo3
jo3

Reputation: 15

Rails custom validation messages

I'm trying to set form validation with cyrillic alphabet but I get

We're sorry, but something went wrong.

Here is the code that I use

  validates_presence_of :user, :message => "кирилица"

What is wrong here ?

Upvotes: 0

Views: 319

Answers (1)

systho
systho

Reputation: 1161

You forgot to tell ruby that your source file is in utf-8

Ruby 1.9 assumes your source files are US-ASCII encoded unless you provide an

# encoding: utf-8 

comment at the beginning of your source file

PS : I would suggest you to use i18n to store your validation messages. You can find info about the mechanism here, it will allow you to either change default messages or specific messages for a model.

Upvotes: 2

Related Questions