ish_models 0.0.33.133 → 0.0.33.137

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: 2d50f29ed3d0a85e7d16177bd79b9fe6c3271ad17b4cb888c81c44b451a1f28d
4
- data.tar.gz: 8ab4c58c78a5967a2096d9aacc58a0568442ea1ff3477d353cbe8a42f3ce5ded
3
+ metadata.gz: b90fe8d9b148631d369ef4f8d6ef435b983784a0fb520654544f2b51bf52cdb2
4
+ data.tar.gz: b3f626ccae620eebf147f8edeff38ee84074fd672c37bd030a9712cca5aea437
5
5
  SHA512:
6
- metadata.gz: 1e53ea5ade3eaec46a41f2469c27ff60bf4feaf8e989cc1091173e16d4788e4f262150f5b84045c3d717fadd4f4fad09e982474d11fddd0b2f7bf5b1a0abeffc
7
- data.tar.gz: 6c618c59a51c4a05dec7725cf21211bf5ce9b5f35dea634ed83f1f1db98a5252f00199096de651ae75ec1199ae36a0295d2a993fcc564c0a80c8ee3d2ba66d27
6
+ metadata.gz: d2163cae83c7270a83106f36730e52518a4cf7fa384f67f5fde60b1fd5f90b4c781a506cac1050fcbec1cd399ccb9e909dac700d2235bd3b0714dd3016543456
7
+ data.tar.gz: 1584fb6192513d6531f479b6eafbc1c4695d213ca66f9d8c1de0e4ea10e3c050e6e4ecc74667157e61564c0b346e31d264d38ee5eb9a8b9e192a72d28ba7e6ca
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,48 +23,46 @@ 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, :type => String
29
+ field :descr, :type => String, :as => :description
30
+ field :lang, :type => String, :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
+
39
+ ## @TODO: I should have a redirect service, instead of this specific thing. But only after making $50.
40
+ # embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
41
+
24
42
 
25
43
  def self.list conditions = { :is_trash => false }
26
44
  out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
27
45
  [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
28
46
  end
29
47
 
30
- belongs_to :site, :optional => true
31
- # validates :site, :presence => true
32
-
48
+ belongs_to :site, :optional => true
33
49
  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
50
 
40
- field :galleryname
41
- index({ :galleryname => -1 }, { :unique => true })
42
- embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
43
- def self.find_by_slug slug
44
- ::Gallery.where( galleryname: slug ).first
45
- end
46
-
47
- field :subhead, :type => String
48
- field :descr, :type => String, :as => :description
49
- field :lang, :type => String, :default => 'en'
51
+ has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
52
+ has_and_belongs_to_many :tags
50
53
 
54
+ has_many :newsitems
51
55
  has_many :photos
52
56
 
53
- has_and_belongs_to_many :tags
54
57
  belongs_to :city, :optional => true
55
58
  belongs_to :venue, :optional => true
59
+ belongs_to :newsparent, polymorphic: true, optional: true
56
60
 
57
- has_many :newsitems
58
61
 
59
62
  set_callback(:create, :before) do |doc|
60
63
  if doc.user_profile && doc.user_profile.name
61
64
  doc.username = doc.user_profile.name
62
65
  end
63
- doc.galleryname ||= doc.id.to_s
64
66
 
65
67
  #
66
68
  # newsitems
@@ -104,16 +106,13 @@ class Gallery
104
106
 
105
107
  # @deprecated, use Gallery::ACTIONS
106
108
  def self.actions
107
- [ 'show_mini', 'show_long', 'show' ]
109
+ ACTIONS
108
110
  end
109
111
  ACTIONS = [ 'show_mini', 'show_long', 'show' ]
110
112
 
111
- field :issue
112
-
113
113
  RENDER_TITLES = 'index_titles' # view name
114
114
  RENDER_THUMBS = 'index_thumbs' # view name
115
115
 
116
- belongs_to :newsparent, polymorphic: true, optional: true
117
116
 
118
117
  set_callback :update, :after do |doc|
119
118
  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,24 @@
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 })
13
14
 
14
- field :descr, :type => String
15
+ ## Can be one of: default (nil), longscroll
16
+ field :item_type, type: String
17
+
18
+ field :descr, :type => String
15
19
 
16
20
  field :is_trash, :type => Boolean, :default => false
17
- index :is_trash => 1, :is_public => 1
21
+ index :is_trash => 1, :is_public => 1
18
22
 
19
23
  field :is_public, :type => Boolean, :default => true
20
24
  index({ :is_public => 1 })
@@ -27,13 +31,13 @@ class Report
27
31
 
28
32
  field :is_done, :type => Boolean, :default => true
29
33
  index({ :is_done => 1 })
30
-
34
+
31
35
  field :x, :type => Float
32
36
  field :y, :type => Float
33
37
 
34
38
  field :lang, :type => String, :default => 'en'
35
39
  index({ :lang => 1 })
36
-
40
+
37
41
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile'
38
42
 
39
43
  # validates :user, :presence => true, :allow_nil => false
@@ -43,14 +47,14 @@ class Report
43
47
 
44
48
  field :issue
45
49
  field :subhead
46
-
50
+
47
51
  belongs_to :city, :optional => true
48
52
  belongs_to :site, :optional => true
49
53
  belongs_to :cities_user, :optional => true
50
54
 
51
55
  has_and_belongs_to_many :tags
52
56
  has_and_belongs_to_many :venues
53
-
57
+
54
58
  has_one :photo
55
59
 
56
60
  field :n_upvotes, :default => 0
@@ -59,15 +63,15 @@ class Report
59
63
  default_scope ->{
60
64
  where({ is_public: true, is_trash: false }).order_by({ created_at: :desc })
61
65
  }
62
-
66
+
63
67
  has_many :newsitems
64
68
 
65
69
  def self.list conditions = { :is_trash => false }
66
70
  out = self.where( conditions ).order_by( :name => :asc ).limit( 100 )
67
71
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
68
72
  end
69
-
70
- PER_PAGE = 20
73
+
74
+ PER_PAGE = 20
71
75
  def self.paginates_per
72
76
  self::PER_PAGE
73
77
  end
@@ -75,33 +79,30 @@ class Report
75
79
  def venue
76
80
  return self.venues[0] || nil
77
81
  end
78
-
82
+
79
83
  def self.all
80
84
  self.where( :is_public => true, :is_trash => false ).order_by( :created_at => :desc )
81
85
  end
82
-
86
+
83
87
  def self.not_tagged
84
88
  Report.where( :tag_ids => nil, :city => nil )
85
89
  end
86
-
90
+
87
91
  def self.for_homepage args
88
92
  begin
89
93
  tag_ids = args[:main_tag].children_tags.map { |tag| tag._id } + [ args[:main_tag]._id ]
90
94
  return Report.where( :tag_ids.in => tag_ids ).page args[:page]
91
95
  rescue
92
- return Report.page args[:page]
96
+ return Report.page args[:page]
93
97
  end
94
98
  end
95
99
 
96
- before_validation :set_name_seo, :on => :create
97
- def set_name_seo
98
- self.name_seo ||= self.name.gsub(' ', '-').gsub('.', '')
99
- end
100
+ before_validation :set_slug, :on => :create
100
101
 
101
102
  set_callback :update, :after do |doc|
102
103
  Site.update_all updated_at: Time.now
103
104
  end
104
-
105
+
105
106
  set_callback :create, :after do |doc|
106
107
  if doc.is_public
107
108
 
@@ -115,7 +116,7 @@ class Report
115
116
  v.newsitems << n
116
117
  v.save
117
118
  end
118
- end
119
+ end
119
120
 
120
121
  unless doc.city.blank?
121
122
  city = City.find doc.city.id
@@ -131,7 +132,7 @@ class Report
131
132
  end
132
133
  end
133
134
  end
134
-
135
+
135
136
  def self.clear
136
137
  if Rails.env.test?
137
138
  self.unscoped.each { |r| r.remove }
@@ -149,5 +150,5 @@ class Report
149
150
  end
150
151
  def premium?; is_premium; end
151
152
  has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
152
-
153
+
153
154
  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.133
4
+ version: 0.0.33.137
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