Sha256: 038186d7269beb77eff53954d9bd27f6e6ccc96a94e19937d4217ccfb875617d

Contents?: true

Size: 693 Bytes

Versions: 94

Compression:

Stored size: 693 Bytes

Contents

class AppModel2
  include ::Mongoid::Document
  include ::Mongoid::Timestamps

  field :is_public,    :type => Boolean, :default => false
  field :is_trash,     :type => Boolean, :default => false

  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( :created_at => :desc )
    [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
  end

  private

  def puts! arg, label=""
    puts "+++ +++ #{label}"
    puts arg.inspect
  end
  
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
ish_models-0.0.33.140 lib/app_model2.rb
ish_models-0.0.33.139 lib/app_model2.rb
ish_models-0.0.33.138 lib/app_model2.rb
ish_models-0.0.33.137 lib/app_model2.rb
ish_models-0.0.33.136 lib/app_model2.rb
ish_models-0.0.33.135 lib/app_model2.rb
ish_models-0.0.33.134 lib/app_model2.rb
ish_models-0.0.33.133 lib/app_model2.rb
ish_models-0.0.33.132 lib/app_model2.rb
ish_models-0.0.33.131 lib/app_model2.rb
ish_models-0.0.33.130 lib/app_model2.rb
ish_models-0.0.33.129 lib/app_model2.rb
ish_models-0.0.33.128 lib/app_model2.rb
ish_models-0.0.33.127 lib/app_model2.rb
ish_models-0.0.33.124 lib/app_model2.rb
ish_models-0.0.33.123 lib/app_model2.rb
ish_models-0.0.33.122 lib/app_model2.rb
ish_models-0.0.33.121 lib/app_model2.rb
ish_models-0.0.33.120 lib/app_model2.rb
ish_models-0.0.33.119 lib/app_model2.rb