Q:

rails - problems with validation in concern

I have problems with validation in concern
There is class
/app/models/group.rb
class Group < AbstractModel
  include Localized::Title

  ...

end

/app/models/concerns/localized/title.rb
module Localized::Title
  extend ActiveSupport::Concern
  include ActiveModel::Validations

  include do 
    validates :title_ua, length: {minimum: 3, maximum: 200}, uniqueness: true
    validates :title_ru, length: {minimum: 3, maximum: 200}, uniqueness: true
  end

...

end

When I try to use validation in model it's works, but not in concern.
Help me please, what I do wrong?
P.S. AbstractModel < ActiveRecord::Base,
rails 4.2, ruby 2.2.0p0

A:

it's 'included' not include. Try it like this:
module Localized::Title
  extend ActiveSupport::Concern
  include ActiveModel::Validations

  included do 
    validates :title_ua, length: {minimum: 3, maximum: 200}, uniqueness: true
    validates :title_ru, length: {minimum: 3, maximum: 200}, uniqueness: true
  end

...

end

