Hi! I plan to use ActiveModel::Validator to validate a plain Ruby class, but I have intention to keep all validations outside the original class, while using PresenceValidator and FormatValidator, default on Rails. Something like this:
# payer.rb module MyMoip class Payer include ActiveModel::Validations attr_accessor :id, :name, :email, :address_street, :address_street_number, :address_street_extra, :address_neighbourhood, :address_city, :address_state, :address_country, :address_cep, :address_phone validates_with Validators::PayerValidator end end # payer_validator.rb module MyMoip module Validators class PayerValidator < ActiveModel::Validator validate :id, presence: true def validate(record) # more complex validations end end end end It is possible? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.