<commit_before>class Role < ActiveRecord::Base
  validates :name, :uniqueness => true,
  			:presence => true, :length => {:minimum => 4}
  validates :description, :presence => true

  has_many :user_roles
  has_many :users, :through => :user_roles
end<commit_msg>добавлен метод search, чтобы проходили тесты<commit_after>class Role < ActiveRecord::Base
  validates :name, :uniqueness => true,
  			:presence => true, :length => {:minimum => 4}
  validates :description, :presence => true

  has_many :user_roles
  has_many :users, :through => :user_roles

  def self.search(search)
   if search
      where('name LIKE ? or description LIKE ?', "%#{search}%", "%#{search}%")
    else
      scoped
    end
  end
  
end
{'fraction_non_alphanumeric': 0.13668061366806136, 'fraction_numerical': 0.002789400278940028, 'mean_word_length': 4.092198581560283, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5663625', 'n_tokens_mistral': 254, 'n_tokens_neox': 243, 'n_words': 65}