forgeplus/app/models/concerns/projectable.rb

16 lines
361 B
Ruby
Raw Normal View History

2020-03-09 00:40:16 +08:00
module Projectable
extend ActiveSupport::Concern
included do
has_many :projects, -> { order(position: :asc) }
scope :without_content, -> { select(column_names - ['content'])}
scope :search, lambda { |keywords|
where("name LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
}
end
module ClassMethods
end
end