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.
- checksums.yaml +4 -4
- data/lib/app_model2.rb +1 -7
- data/lib/gallery.rb +16 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a37d0fcd4c4c24c3102dd0064ba230d5e5f95a19
|
4
|
+
data.tar.gz: 3fdeb77d032c2bca1fa0b1beab2a022dc7f0de6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|