ish_models 0.0.33.34 → 0.0.33.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/app_model2.rb +1 -7
  3. data/lib/gallery.rb +16 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6224a88b14517a927d1789ec48422ab9f29c044
4
- data.tar.gz: 51cfd79fcf9636e27365b92d0836bd439d635923
3
+ metadata.gz: a37d0fcd4c4c24c3102dd0064ba230d5e5f95a19
4
+ data.tar.gz: 3fdeb77d032c2bca1fa0b1beab2a022dc7f0de6f
5
5
  SHA512:
6
- metadata.gz: 79b2995463a84b977d4e4ef3b322aab9bc0f363ddc06e6fc15fa6734fc03947c8b7008a5ec711096da7de32f52432d4a5765c365acaf1f75caf5fe1922f2bf16
7
- data.tar.gz: ff2a76f3c0e99da51111201370017595fdaa87b0a86ab9910470e751e59a27b5ec1d0bc4601796fb12a4089896cb78f42b146694689b5d7c3c0e0ccbf1257a9e
6
+ metadata.gz: 4a31698d3fb34afa96df9f049882264a2e736486fe5f389358f192c08f11f6baeff14119f763e6c729895607dbcf611adfae258b3606dd980b7aad4dd8ba9156
7
+ data.tar.gz: e5758a82f506de0db57f5a074a322909ecd21de29cf6b50c0f2c0d40173b47cffede44379e69e390cc616ca164382ff4503ef9d4629364f512944edda4fe9410
data/lib/app_model2.rb CHANGED
@@ -1,17 +1,11 @@
1
+
1
2
  class AppModel2
2
3
  include ::Mongoid::Document
3
4
  include ::Mongoid::Timestamps
4
5
 
5
- field :is_feature, :type => Boolean, :default => false
6
6
  field :is_public, :type => Boolean, :default => false
7
- field :is_done, :type => Boolean, :default => false
8
7
  field :is_trash, :type => Boolean, :default => false
9
8
 
10
- scope :fresh, ->{ where({ :is_trash => false }) }
11
- scope :trash, ->{ where({ :is_trash => true }) }
12
- scope :public, ->{ where({ :is_public => true }) }
13
- scope :done, ->{ where({ :is_done => true }) }
14
-
15
9
  default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
16
10
 
17
11
  field :x, :type => Float
data/lib/gallery.rb CHANGED
@@ -1,5 +1,20 @@
1
1
 
2
- class Gallery < AppModel2
2
+ class Gallery
3
+ include ::Mongoid::Document
4
+ include ::Mongoid::Timestamps
5
+
6
+ field :is_public, :type => Boolean, :default => false
7
+ field :is_trash, :type => Boolean, :default => false
8
+
9
+ default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
10
+
11
+ field :x, :type => Float
12
+ field :y, :type => Float
13
+
14
+ def self.list conditions = { :is_trash => false }
15
+ out = self.where( conditions ).order_by( :created_at => :desc )
16
+ [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
17
+ end
3
18
 
4
19
  belongs_to :site
5
20
  validates :site, :presence => true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.34
4
+ version: 0.0.33.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox