ish_models 0.0.33.134 → 0.0.33.138

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d922df26e696ac770c512266ee8b46206cb27068acba43df008250e3d1f3a62
4
- data.tar.gz: 3fbc130546d38392d78fef959448eea0642a70cb76cdd9194f3924867877d204
3
+ metadata.gz: fae967dffb3be2dfc17016af14b8b86e7f3c15e71c042ef6616c03fa7fc1a823
4
+ data.tar.gz: d4f56b950da547e32832d92c5366bdb352ce88930359253077d7cde3bcc8bd4d
5
5
  SHA512:
6
- metadata.gz: 98cebce56b2f8a979808d1e1e2bff952601fb7322bcbde228d8ec643656da4b665849782a4a1a5e30eabc36c747b70b57d9d950b1cd544d63444bf93ca5d79e9
7
- data.tar.gz: 73c95a9da8539641a6f5f9d14a2d0c27721f713cad23223727927aa5eb2e422b464007a277810262b20fd6a052882ecd4f79fe1faaf24c83093a7152af198ad2
6
+ metadata.gz: 5c93000c2c58774c2c29e1eef2e7d835778ffe13c9d75e5c1bf1536db481500e315e1975a8c73449da96f933751ff8e3b5d8ae35d07d74f4626084eec745a527
7
+ data.tar.gz: 15f58894be9232aa874a06b1f62eecb53a8d0edb1da34360f63f98d9e100e0a2fefec36092d3b15de32142ce06ddd13d2f2500193ebed8d2595af5446b413790
data/lib/city.rb CHANGED
@@ -36,7 +36,7 @@ class City
36
36
  has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
37
37
  has_one :guide, :class_name => '::IshModels::UserProfile', :inverse_of => :guide_city
38
38
 
39
- embeds_many :features
39
+ has_many :features
40
40
 
41
41
  field :calendar_frame, :type => String
42
42
  field :is_active, type: Boolean, default: true
data/lib/feature.rb CHANGED
@@ -1,31 +1,25 @@
1
1
 
2
- class Feature
3
-
2
+ class Feature
4
3
  include Mongoid::Document
5
4
  include Mongoid::Timestamps
6
5
 
7
- field :name, :type => String
8
- field :subhead, :type => String
6
+ field :name
7
+ field :subhead
9
8
 
10
- field :image_path, :type => String
11
- field :link_path, :type => String
12
- field :partial_name, :type => String
13
- field :inner_html, :type => String
14
- field :weight, :type => Integer, :default => 10
15
-
16
- belongs_to :photo, :optional => true
17
- belongs_to :report, :optional => true
18
- belongs_to :gallery, :optional => true
19
- belongs_to :video, :optional => true
20
- # has_one :photo
21
- # has_one :report
22
- # has_one :gallery
23
- # has_one :video
9
+ field :image_path
10
+ field :link_path
11
+ field :partial_name
12
+ field :inner_html
13
+ field :weight, type: Integer, default: 10
24
14
 
25
- embedded_in :venue
26
- embedded_in :site
27
- embedded_in :city
28
- embedded_in :tag
15
+ belongs_to :city, optional: true
16
+ belongs_to :gallery, optional: true
17
+ belongs_to :photo, optional: true
18
+ belongs_to :report, optional: true
19
+ belongs_to :site, optional: true
20
+ belongs_to :tag, optional: true
21
+ belongs_to :video, optional: true
22
+ belongs_to :venue, optional: true
29
23
 
30
24
  def self.all
31
25
  self.order_by( :created_at => :desc )
@@ -34,5 +28,5 @@ class Feature
34
28
  def self.n_features
35
29
  4
36
30
  end
37
-
31
+
38
32
  end
data/lib/gallery.rb CHANGED
@@ -3,9 +3,13 @@ require 'kaminari/mongoid'
3
3
  class Gallery
4
4
  include ::Mongoid::Document
5
5
  include ::Mongoid::Timestamps
6
+ include Ish::Utils
6
7
 
7
8
  PER_PAGE = 6
8
9
 
10
+ field :name
11
+ validates :name, :uniqueness => true # , :allow_nil => false
12
+
9
13
  field :is_public, type: Boolean, default: false
10
14
  field :is_trash, type: Boolean, default: false
11
15
  field :is_done, type: Boolean, default: false
@@ -19,51 +23,47 @@ class Gallery
19
23
 
20
24
  default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
21
25
 
22
- field :x, :type => Float
23
- field :y, :type => Float
26
+ field :x, :type => Float
27
+ field :y, :type => Float
28
+ field :subhead
29
+ field :descr, :as => :description
30
+ field :lang, :default => 'en'
31
+ field :issue
32
+ field :username
33
+
34
+ ## @TODO: this is still not autogenerated
35
+ field :slug
36
+ index({ :slug => -1 }, { :unique => true })
37
+ validates :slug, presence: true, uniqueness: true
38
+ before_validation :set_slug, :on => :create
39
+
40
+ ## @TODO: I should have a redirect service, instead of this specific thing. But only after making $50.
41
+ # embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
42
+
24
43
 
25
44
  def self.list conditions = { :is_trash => false }
26
45
  out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
27
46
  [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
28
47
  end
29
48
 
30
- belongs_to :site, :optional => true
31
- # validates :site, :presence => true
32
-
49
+ belongs_to :site, :optional => true
33
50
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile', :inverse_of => :galleries
34
- field :username, :type => String
35
- has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
36
-
37
- field :name
38
- validates :name, :uniqueness => true # , :allow_nil => false
39
51
 
40
- field :galleryname
41
- index({ :galleryname => -1 }, { :unique => true })
42
- def slug
43
- galleryname
44
- end
45
- embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
46
- def self.find_by_slug slug
47
- ::Gallery.where( galleryname: slug ).first
48
- end
49
-
50
- field :subhead, :type => String
51
- field :descr, :type => String, :as => :description
52
- field :lang, :type => String, :default => 'en'
52
+ has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
53
+ has_and_belongs_to_many :tags
53
54
 
55
+ has_many :newsitems
54
56
  has_many :photos
55
57
 
56
- has_and_belongs_to_many :tags
57
58
  belongs_to :city, :optional => true
58
59
  belongs_to :venue, :optional => true
60
+ belongs_to :newsparent, polymorphic: true, optional: true
59
61
 
60
- has_many :newsitems
61
62
 
62
63
  set_callback(:create, :before) do |doc|
63
64
  if doc.user_profile && doc.user_profile.name
64
65
  doc.username = doc.user_profile.name
65
66
  end
66
- doc.galleryname ||= doc.id.to_s
67
67
 
68
68
  #
69
69
  # newsitems
@@ -107,16 +107,13 @@ class Gallery
107
107
 
108
108
  # @deprecated, use Gallery::ACTIONS
109
109
  def self.actions
110
- [ 'show_mini', 'show_long', 'show' ]
110
+ ACTIONS
111
111
  end
112
112
  ACTIONS = [ 'show_mini', 'show_long', 'show' ]
113
113
 
114
- field :issue
115
-
116
114
  RENDER_TITLES = 'index_titles' # view name
117
115
  RENDER_THUMBS = 'index_thumbs' # view name
118
116
 
119
- belongs_to :newsparent, polymorphic: true, optional: true
120
117
 
121
118
  set_callback :update, :after do |doc|
122
119
  Site.update_all updated_at: Time.now
data/lib/gameui/map.rb CHANGED
@@ -4,7 +4,7 @@ class ::Gameui::Map
4
4
  include Mongoid::Timestamps
5
5
 
6
6
  has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
7
- has_many :newsitems, inverse_of: :map
7
+ has_many :newsitems, inverse_of: :map, order: :created_at.desc
8
8
 
9
9
  field :slug
10
10
  validates :slug, uniqueness: true, presence: true
@@ -24,6 +24,12 @@ class ::Gameui::Map
24
24
  field :name
25
25
  field :description
26
26
 
27
+ ## Possible keys: description, map, markers, newsitems,
28
+ field :labels, type: Object, default: {}
29
+ ## Possible keys:
30
+ ## config.description.collapsible
31
+ field :config, type: Object, default: {}
32
+
27
33
  # @deprecated, dont use!
28
34
  field :img_path
29
35
 
data/lib/gameui/marker.rb CHANGED
@@ -6,7 +6,8 @@ class ::Gameui::Marker
6
6
  belongs_to :map, :class_name => '::Gameui::Map'
7
7
 
8
8
  field :slug
9
- validates :slug, uniqueness: true, presence: true
9
+ validates_uniqueness_of :slug, scope: :map_id
10
+ validates_presence_of :slug
10
11
 
11
12
  field :description
12
13
 
data/lib/ish/utils.rb ADDED
@@ -0,0 +1,25 @@
1
+
2
+ module Ish::Utils
3
+
4
+ private
5
+
6
+ def set_slug
7
+ return if slug
8
+ new_slug = name.downcase.gsub(/[^a-z0-9\s]/i, '').gsub(' ', '-')
9
+ if self.class.where( slug: new_slug ).first
10
+ loop do
11
+ if new_slug[new_slug.length-1].to_i != 0
12
+ # inrement last digit
13
+ last_digit = new_slug[new_slug.length-1].to_i
14
+ new_slug = "#{new_slug[0...new_slug.length-1]}#{last_digit+1}"
15
+ else
16
+ # add '-1' to the end
17
+ new_slug = "#{new_slug}-1"
18
+ end
19
+ break if !self.class.where( slug: new_slug ).first
20
+ end
21
+ end
22
+ self.slug = new_slug
23
+ end
24
+
25
+ end
@@ -16,11 +16,13 @@ class IshModels::UserProfile
16
16
  field :fb_long_access_token
17
17
  field :fb_expires_in
18
18
 
19
- field :lang, :type => String, :default => :en
19
+ field :lang, default: 'en'
20
20
 
21
21
  ROLES = [ :admin, :manager, :guy ]
22
22
  field :role_name, :type => Symbol
23
23
 
24
+ has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
25
+
24
26
  belongs_to :user
25
27
  belongs_to :current_city, :class_name => 'City', :inverse_of => :current_users, :optional => true
26
28
  belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide, :optional => true
@@ -90,16 +92,3 @@ class IshModels::UserProfile
90
92
  end
91
93
 
92
94
  Profile = IshModels::UserProfile
93
-
94
- =begin
95
- field :about, :type => String
96
- field :education, :type => String
97
- field :objectives, :type => String
98
- field :current_employment, :type => String
99
- field :past_employment, :type => String
100
- field :pdf_resume_path, :type => String
101
- field :doc_resume_path, :type => String
102
-
103
- TAGS = [ :social, :professional ]
104
- field :tag, :type => Symbol
105
- =end
data/lib/ish_models.rb CHANGED
@@ -34,23 +34,24 @@ require 'gameui/map_bookmark.rb'
34
34
  require 'gameui/marker.rb'
35
35
  require 'gameui/premium_purchase.rb'
36
36
 
37
+ # require 'ish/alphavantage_stockwatcher.rb'
37
38
  require 'ish/ameritrade'
39
+ require 'ish/campaign.rb'
38
40
  require 'ish/covered_call'
39
41
  require 'ish/crawler.rb'
40
42
  require 'ish/gallery_name.rb'
41
43
  require 'ish/image_asset.rb'
42
44
  require 'ish/input_error.rb'
45
+ require 'ish/invoice.rb'
43
46
  require 'ish/iron_condor.rb'
44
47
  require 'ish/iron_condor_watcher.rb'
48
+ require 'ish/issue.rb'
49
+ require 'ish/lead.rb'
45
50
  require 'ish/payment.rb'
46
51
  require 'ish/stock_action.rb'
47
52
  require 'ish/stock_option.rb'
48
53
  require 'ish/stock_watch.rb'
49
- # require 'ish/alphavantage_stockwatcher.rb'
50
- require 'ish/invoice.rb'
51
- require 'ish/lead.rb'
52
- require 'ish/campaign.rb'
53
- require 'ish/issue.rb'
54
+ require 'ish/utils.rb'
54
55
  require 'ish/yahoo_stockwatcher.rb'
55
56
 
56
57
  # obsolete, use `ish` namespace now
data/lib/newsitem.rb CHANGED
@@ -20,6 +20,10 @@ class Newsitem
20
20
 
21
21
  field :name
22
22
  field :descr
23
+ def description
24
+ descr
25
+ end
26
+
23
27
  field :image_path
24
28
  field :link_path
25
29
  field :username
data/lib/photo.rb CHANGED
@@ -5,17 +5,16 @@ class Photo
5
5
  include Mongoid::Timestamps
6
6
  include Mongoid::Paperclip
7
7
 
8
- # belongs_to :user, :inverse_of => :photos
9
- # validates :user, :presence => true
10
- # field :username, :type => String
11
-
12
8
  has_and_belongs_to_many :viewers, :class_name => 'User', :inverse_of => :viewable_photos
13
9
 
14
10
  belongs_to :user_profile, :class_name => 'IshModels::UserProfile', :optional => true
15
- def user; user_profile; end
16
- belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
17
- belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
18
- belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
11
+ def user
12
+ user_profile
13
+ end
14
+ belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
15
+ belongs_to :user_profile, :class_name => 'IshModels::UserProfile', :inverse_of => :profile_photo, :optional => true
16
+ belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
17
+ belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
19
18
 
20
19
  belongs_to :report, :optional => true
21
20
  belongs_to :venue, :optional => true
data/lib/report.rb CHANGED
@@ -1,20 +1,25 @@
1
1
  class Report
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
+ include Ish::Utils
4
5
 
5
6
  field :name, :type => String
6
7
  validates :name, :presence => true
7
8
  # index({ :name => 1 }, { :unique => true })
8
9
  index({ :name => 1, :is_trash => 1 })
9
10
 
10
- field :name_seo, :type => String
11
- validates :name_seo, :uniqueness => true, :presence => true
12
- index({ :name_seo => 1 }, { :unique => true })
11
+ field :slug
12
+ validates :slug, :uniqueness => true, :presence => true
13
+ index({ :slug => 1 }, { :unique => true })
14
+ before_validation :set_slug, :on => :create
13
15
 
14
- field :descr, :type => String
16
+ ## Can be one of: default (nil), longscroll
17
+ field :item_type, type: String
18
+
19
+ field :descr, :type => String
15
20
 
16
21
  field :is_trash, :type => Boolean, :default => false
17
- index :is_trash => 1, :is_public => 1
22
+ index :is_trash => 1, :is_public => 1
18
23
 
19
24
  field :is_public, :type => Boolean, :default => true
20
25
  index({ :is_public => 1 })
@@ -27,13 +32,13 @@ class Report
27
32
 
28
33
  field :is_done, :type => Boolean, :default => true
29
34
  index({ :is_done => 1 })
30
-
35
+
31
36
  field :x, :type => Float
32
37
  field :y, :type => Float
33
38
 
34
39
  field :lang, :type => String, :default => 'en'
35
40
  index({ :lang => 1 })
36
-
41
+
37
42
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile'
38
43
 
39
44
  # validates :user, :presence => true, :allow_nil => false
@@ -43,14 +48,14 @@ class Report
43
48
 
44
49
  field :issue
45
50
  field :subhead
46
-
51
+
47
52
  belongs_to :city, :optional => true
48
53
  belongs_to :site, :optional => true
49
54
  belongs_to :cities_user, :optional => true
50
55
 
51
56
  has_and_belongs_to_many :tags
52
57
  has_and_belongs_to_many :venues
53
-
58
+
54
59
  has_one :photo
55
60
 
56
61
  field :n_upvotes, :default => 0
@@ -59,15 +64,15 @@ class Report
59
64
  default_scope ->{
60
65
  where({ is_public: true, is_trash: false }).order_by({ created_at: :desc })
61
66
  }
62
-
67
+
63
68
  has_many :newsitems
64
69
 
65
70
  def self.list conditions = { :is_trash => false }
66
71
  out = self.where( conditions ).order_by( :name => :asc ).limit( 100 )
67
72
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
68
73
  end
69
-
70
- PER_PAGE = 20
74
+
75
+ PER_PAGE = 20
71
76
  def self.paginates_per
72
77
  self::PER_PAGE
73
78
  end
@@ -75,33 +80,30 @@ class Report
75
80
  def venue
76
81
  return self.venues[0] || nil
77
82
  end
78
-
83
+
79
84
  def self.all
80
85
  self.where( :is_public => true, :is_trash => false ).order_by( :created_at => :desc )
81
86
  end
82
-
87
+
83
88
  def self.not_tagged
84
89
  Report.where( :tag_ids => nil, :city => nil )
85
90
  end
86
-
91
+
87
92
  def self.for_homepage args
88
93
  begin
89
94
  tag_ids = args[:main_tag].children_tags.map { |tag| tag._id } + [ args[:main_tag]._id ]
90
95
  return Report.where( :tag_ids.in => tag_ids ).page args[:page]
91
96
  rescue
92
- return Report.page args[:page]
97
+ return Report.page args[:page]
93
98
  end
94
99
  end
95
100
 
96
- before_validation :set_name_seo, :on => :create
97
- def set_name_seo
98
- self.name_seo ||= self.name.gsub(' ', '-').gsub('.', '')
99
- end
101
+
100
102
 
101
103
  set_callback :update, :after do |doc|
102
104
  Site.update_all updated_at: Time.now
103
105
  end
104
-
106
+
105
107
  set_callback :create, :after do |doc|
106
108
  if doc.is_public
107
109
 
@@ -115,7 +117,7 @@ class Report
115
117
  v.newsitems << n
116
118
  v.save
117
119
  end
118
- end
120
+ end
119
121
 
120
122
  unless doc.city.blank?
121
123
  city = City.find doc.city.id
@@ -131,7 +133,7 @@ class Report
131
133
  end
132
134
  end
133
135
  end
134
-
136
+
135
137
  def self.clear
136
138
  if Rails.env.test?
137
139
  self.unscoped.each { |r| r.remove }
@@ -149,5 +151,5 @@ class Report
149
151
  end
150
152
  def premium?; is_premium; end
151
153
  has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
152
-
154
+
153
155
  end
data/lib/site.rb CHANGED
@@ -30,7 +30,7 @@ class Site
30
30
  field :is_primary, :type => Boolean, :default => false
31
31
  field :is_private, :type => Boolean, :default => false
32
32
  field :private_user_emails, :type => Array, :default => []
33
-
33
+
34
34
  field :homepage_layout, :type => String, :default => 'show'
35
35
  field :layout, :type => String, :default => 'application'
36
36
 
@@ -40,9 +40,8 @@ class Site
40
40
  has_many :videos
41
41
  has_many :newsitems, :order => :created_at.desc
42
42
  has_many :issues, :class_name => 'Ish::Issue'
43
+ has_many :features, :order => :created_at.desc
43
44
 
44
- embeds_many :features, :order => :created_at.desc
45
-
46
45
  default_scope ->{ where({ :is_trash => false }).order_by({ :domain => :asc, :lang => :asc }) }
47
46
 
48
47
  set_callback :create, :before do |doc|
@@ -61,7 +60,7 @@ class Site
61
60
  end
62
61
 
63
62
  LANGUAGES = [ 'en', 'ru', 'pt' ]
64
-
63
+
65
64
  # manager uses it.
66
65
  def self.list
67
66
  out = self.all.order_by( :domain => :asc, :lang => :asc )
@@ -79,7 +78,7 @@ class Site
79
78
  def n_private_reports
80
79
  self.reports.unscoped.where( :is_public => false, :is_trash => false ).length
81
80
  end
82
-
81
+
83
82
  def its_locales
84
83
  Site.where( :domain => self.domain ).map { |s| s.lang.to_sym }
85
84
  end
data/lib/tag.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  class Tag
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
+ include Ish::Utils
4
5
 
5
6
  field :name, :type => String
6
7
  # validates :name, :uniqueness => true, :allow_nil => false
7
8
 
8
- field :name_seo, :as => :tagname
9
- validates :name_seo, :uniqueness => true, :allow_nil => false
9
+ field :slug
10
+ validates :slug, :uniqueness => true, presence: true, allow_nil: false
10
11
 
11
12
  field :descr, :type => String, :default => ''
12
13
 
@@ -19,8 +20,7 @@ class Tag
19
20
  has_many :children_tags, :class_name => 'Tag', :inverse_of => :parent_tag
20
21
  belongs_to :parent_tag, :class_name => 'Tag', :inverse_of => :children_tags, :optional => true
21
22
 
22
- embeds_many :features
23
- # embeds_many :newsitems
23
+ has_many :features
24
24
  has_many :newsitems
25
25
 
26
26
  belongs_to :site, :optional => true
@@ -36,11 +36,7 @@ class Tag
36
36
  where({ :is_public => true, :is_trash => false }).order_by({ :name => :asc })
37
37
  }
38
38
 
39
- before_create do |d|
40
- if d.name_seo.blank?
41
- d.name_seo = d.name.gsub(' ', '-')
42
- end
43
- end
39
+ before_validation :set_slug
44
40
 
45
41
  def self.clear
46
42
  if Rails.env.test?
@@ -72,9 +68,9 @@ class Tag
72
68
  4
73
69
  end
74
70
 
75
- # @deprecated I don't even know why I have this. Should be simplified into non-being.
76
71
  def self.n_features
77
72
  4
78
73
  end
74
+ field :n_features, type: Integer, default: 4
79
75
 
80
76
  end
data/lib/venue.rb CHANGED
@@ -1,16 +1,20 @@
1
1
  class Venue
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
+ include Ish::Utils
5
+
6
+ field :address
4
7
 
5
8
  field :name, :type => String
6
9
  validates :name, :uniqueness => true, :allow_nil => false
7
10
 
8
- field :name_seo, :type => String
9
- validates :name_seo, :uniqueness => true, :allow_nil => false
10
-
11
+ field :slug
12
+ validates :slug, :uniqueness => true, :allow_nil => false
13
+ before_validation :set_slug
14
+
11
15
  field :subhead
12
16
  field :descr
13
-
17
+
14
18
  field :is_trash, :type => Boolean, :default => false
15
19
  scope :fresh, ->{ where({ :is_trash => false }) }
16
20
  scope :trash, ->{ where({ :is_trash => true }) }
@@ -39,9 +43,8 @@ class Venue
39
43
  has_many :reports
40
44
  has_many :galleries
41
45
  has_many :photos
42
-
43
- embeds_many :newsitems
44
- embeds_many :features
46
+ has_many :newsitems
47
+ has_many :features
45
48
 
46
49
  PER_PAGE = 6
47
50
 
@@ -50,9 +53,7 @@ class Venue
50
53
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
51
54
  end
52
55
 
53
- set_callback :create, :before do |doc|
54
- doc.name_seo = doc.name.gsub(' ', '-')
55
- end
56
+
56
57
 
57
58
  set_callback :save, :before do |doc|
58
59
  if doc.city
data/lib/video.rb CHANGED
@@ -53,7 +53,8 @@ class Video
53
53
  :path => "videos/:style/:id/:filename",
54
54
  :s3_protocol => 'https',
55
55
  :s3_permissions => 'public-read',
56
- :validate_media_type => false
56
+ :validate_media_type => false,
57
+ s3_region: ::S3_CREDENTIALS[:region]
57
58
  validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
58
59
 
59
60
  has_mongoid_attached_file :thumb,
@@ -70,7 +71,8 @@ class Video
70
71
  :s3_credentials => ::S3_CREDENTIALS,
71
72
  :path => "videos/:style/:id/thumb_:filename",
72
73
  :s3_protocol => 'https',
73
- :validate_media_type => false
74
+ :validate_media_type => false,
75
+ s3_region: ::S3_CREDENTIALS[:region]
74
76
  validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
75
77
 
76
78
  set_callback :update, :after do |doc|
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.134
4
+ version: 0.0.33.138
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -137,6 +137,7 @@ files:
137
137
  - lib/ish/stock_action.rb
138
138
  - lib/ish/stock_option.rb
139
139
  - lib/ish/stock_watch.rb
140
+ - lib/ish/utils.rb
140
141
  - lib/ish/yahoo_stockwatcher.rb
141
142
  - lib/ish_models.rb
142
143
  - lib/ish_models/cache_key.rb