Sha256: 0aedb0c3f395a201edf3ec450b53415f34b871e685384b4d9394e8fd04be015e
Contents?: true
Size: 1009 Bytes
Versions: 16
Compression:
Stored size: 1009 Bytes
Contents
class AppModel2 include ::Mongoid::Document include ::Mongoid::Timestamps field :is_feature, :type => Boolean, :default => false field :is_public, :type => Boolean, :default => true field :is_done, :type => Boolean, :default => false field :is_trash, :type => Boolean, :default => false field :is_anonymous, :type => Boolean, :default => false scope :fresh, ->{ where({ :is_trash => false }) } scope :trash, ->{ where({ :is_trash => true }) } scope :public, ->{ where({ :is_public => true }) } scope :done, ->{ where({ :is_done => true }) } default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) } field :x, :type => Float field :y, :type => Float def self.list conditions = { :is_trash => false } out = self.where( conditions).order_by( :name => :asc ) [['', nil]] + out.map { |item| [ item.name, item.id ] } end private def puts! arg, label="" puts "+++ +++ #{label}" puts arg.inspect end end
Version data entries
16 entries across 16 versions & 1 rubygems