Sha256: 5ae5dfdbc46d981d28629c73e57789a05cc8a0088fb3dcf3121ec3c241b1f3d2

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

class Post
  include Mongoid::Document
  include Lolita::Configuration
  field :title, type: String
  field :body, type: String
  field :is_public, type: Boolean
  field :price, type: BigDecimal
  field :published_at, type: DateTime, default: -> { Time.now }
  field :expire_date, type: Date
  belongs_to :category
  has_and_belongs_to_many :tags
  has_many :comments
  belongs_to :profile
  validates_presence_of :title
  default_scope order_by([:title, :asc])
  accepts_nested_attributes_for :comments, :reject_if => :all_blank

  lolita

  def self.custom_search query,request=nil,dbi=nil
    self.where(:expire_date.gt => Date.today)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lolita-3.2.0.rc.7 spec/rails_app/app/mongoid/post.rb
lolita-3.1.18 spec/rails_app/app/mongoid/post.rb
lolita-3.2.0.rc.6 spec/rails_app/app/mongoid/post.rb