<commit_before>class Post < ActiveRecord::Base
  attr_accessible :content, :name, :title, :tags_attributes, :tag_ids, :tag_id, :tag

  has_many :comments, :dependent => :destroy
  has_and_belongs_to_many :tags

  validates :name,  :presence => true
  validates :title, :presence => true,
                    :format => URI::regexp(%w(http https)),
                    :length => { :minimum => 5 }

  accepts_nested_attributes_for :tags, :allow_destroy => :true,
    :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }


  @pager = 6
  self.per_page = @pager
  def self.search(search)  
    if search  
      where('name LIKE ?', "%#{search}%")  
    else  
      scoped  
    end  
  end  

end<commit_msg>fixed bug with search and pager<commit_after>class Post < ActiveRecord::Base
  attr_accessible :content, :name, :title, :tags_attributes, :tag_ids, :tag_id, :tag

  has_many :comments, :dependent => :destroy
  has_and_belongs_to_many :tags

  validates :name,  :presence => true
  validates :title, :presence => true,
                    :format => URI::regexp(%w(http https)),
                    :length => { :minimum => 5 }

  accepts_nested_attributes_for :tags, :allow_destroy => :true,
    :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }


  def self.search(search)  
    if search  
      where('name LIKE ?', "%#{search}%")  
    else  
      scoped  
    end  
  end  

end
{'fraction_non_alphanumeric': 0.13810198300283286, 'fraction_numerical': 0.002124645892351275, 'mean_word_length': 2.8086253369272236, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '7346434', 'n_tokens_mistral': 494, 'n_tokens_neox': 474, 'n_words': 116}