ish_models 0.0.33.87 → 0.0.33.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/video.rb +15 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d00e6d3fc00fb69a6e14b26fc9cd98bceb35cd4f9ff264237b7559cb2c2c2f8
4
- data.tar.gz: 0a17595a91d780e7ce4720cf5c6f667d0e6fc82a02897a75a73f4e49f51ed089
3
+ metadata.gz: 5208ac41697c061e5b35209eb06846f63e08feea6e13beeca1aa67902890a69f
4
+ data.tar.gz: fcfb487cecd2d719cceb958871f4a55d88d14703ba6cbd4b5fb5f21945d57927
5
5
  SHA512:
6
- metadata.gz: d18e848135a1f80021438470ed16cc07cc8ab16774d2a71f7c47e191dd131274f4a840f295614708435ad4e0737c87c6d8634c02f7b43832c0dca6ce30471a8f
7
- data.tar.gz: a4198f99401015bf8840b5df893768fd59e518d4af9fbc6303daf90bd54e013da63b3f30d470d74b3e849c989975c58bd0e3dcf22feac7d1eeff339c65614980
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.all.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
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
- has_attached_file :video, styles: {
49
- :thumb => { geometry: '192x108', format: 'jpeg' },
50
- }, processors: [ :transcoder ]
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
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.87
4
+ version: 0.0.33.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox