ish_models 0.0.33.87 → 0.0.33.89
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/video.rb +15 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5208ac41697c061e5b35209eb06846f63e08feea6e13beeca1aa67902890a69f
|
4
|
+
data.tar.gz: fcfb487cecd2d719cceb958871f4a55d88d14703ba6cbd4b5fb5f21945d57927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b004ff025ce0346762f073166c5d21967ce423cc7d23c0f3440f53d65cc92352c2298583e40cd3809950542260bdf874681291f09f46d1dce4eca3b487c9b565
|
7
|
+
data.tar.gz: 971e45f0fbe9d6a203fcaa02e8c30d9687ff25a359d3e0f68972133ee442a8d3fc285dfd551f164e03518e2c247fbc965c464d7ecd98ff24bbd5d1c9f317f8f8
|
data/lib/video.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Video
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
|
+
include Mongoid::Paperclip
|
4
5
|
|
5
6
|
PER_PAGE = 6
|
6
7
|
|
@@ -20,7 +21,7 @@ class Video
|
|
20
21
|
field :lang, :type => String, :default => 'en'
|
21
22
|
|
22
23
|
field :youtube_id, :type => String
|
23
|
-
validates :youtube_id, :uniqueness => true, :presence => true
|
24
|
+
# validates :youtube_id, :uniqueness => true, :presence => true
|
24
25
|
|
25
26
|
belongs_to :tag, :optional => true
|
26
27
|
belongs_to :city, :optional => true
|
@@ -32,7 +33,7 @@ class Video
|
|
32
33
|
accepts_nested_attributes_for :site, :tag, :city
|
33
34
|
|
34
35
|
def self.list
|
35
|
-
[['', nil]] + Video.
|
36
|
+
[['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
36
37
|
end
|
37
38
|
|
38
39
|
set_callback( :create, :before ) do |doc|
|
@@ -45,9 +46,18 @@ class Video
|
|
45
46
|
|
46
47
|
field :issue
|
47
48
|
|
48
|
-
|
49
|
-
:
|
50
|
-
|
49
|
+
has_mongoid_attached_file :video,
|
50
|
+
styles: {
|
51
|
+
:thumb => { geometry: '192x108', format: 'jpeg' },
|
52
|
+
},
|
53
|
+
# processors: [ :transcoder ],
|
54
|
+
:storage => :s3,
|
55
|
+
:s3_credentials => ::S3_CREDENTIALS,
|
56
|
+
:path => "videos/:style/:id/:filename",
|
57
|
+
:s3_protocol => 'https',
|
58
|
+
:s3_permissions => :public_read,
|
59
|
+
:validate_media_type => false
|
60
|
+
|
51
61
|
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
|
52
62
|
|
53
63
|
end
|