How do I get translated error messages in sequel?

I am using Sequel. How do I get ActiveModel-style translated errors?

class User < Sequel::Model
  def validate
    errors.add(:email, :invalid)

@user = # => false
@user.errors.full_messages # => ["email invalid"]

I want it to return a translated error using the config/locales data. When I18n.locale = :en it should return ["Email is invalid"], when I18n.locale = :de it should return ["Derrrrr E-Reichspost ist ung├╝ltig"] (and so on). How can I get translated error messages in sequel?


You need to modify the validation_helpers plugin DEFAULT_OPTIONS. Here's an example:

Need Your Help

Trouble installing Android SDK for Appcelerator studio on windows 7

appcelerator appcelerator-titanium appcelerator-studio

I have trouble installing Appcelerator studio on windows 7. I am getting the following error when trying to create a new mobile project (Alloy project) and run the same on an android device. Works ...

Django: How to automatically change a field's value at the time mentioned in the same object?

python django django-models celery django-celery

I am working on a django project for racing event in which a table in the database has three fields.