lib/ecrire/app/models/title.rb in ecrire-0.25.2 vs lib/ecrire/app/models/title.rb in ecrire-0.26.0

- old
+ new

@@ -36,15 +36,22 @@ end end end + include PgSearch include ActiveModel::Validations validates_with Title::Validator before_validation :generate_slug belongs_to :post, required: true + + pg_search_scope :search_by_name, + against: :name, + :using => { + :tsearch => {:prefix => true} + } scope :slug, lambda { |slug| where('titles.slug = ?', slug) }