ish_models 0.0.33.113 → 0.0.33.118

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f88ffa3b0fdfca2f28fa64cfcab31fa8c68657f19f9f183b681649ad0aad7ebb
4
- data.tar.gz: af98d74b680ccc95742195e1a0810828defe53199189fc277ac4c4c35fd8f512
3
+ metadata.gz: 121558953571ec7ddccd7fa69e5fc6ac7ae66fb854bf3c3af7a6e863c081d7ef
4
+ data.tar.gz: cd512a1f08541937604d4271331f37f08b0612a294ee87b58bc340bc0a8826de
5
5
  SHA512:
6
- metadata.gz: 48ceeba355b79e2b22c03967ab98439dce1422b472ccafb57387b11e05f6d1cefbcaeac10ead91ff8d022c633e23c12e2f74e28a856c55287f9dc57fefa17774
7
- data.tar.gz: e7c8e20330aebe8fb9047a8f37ebfa9ed8ef7332ab4d4468b2516663aed9ad7bb91edc4eca6fbae65275156efb6b29c3428adcd14e727b1ba4332597d3f38716
6
+ metadata.gz: 6d45ea857448f205f82ee8f3a26b8c758781595ad919ae7befd4bd142744d0806ae0d463abfe5fb591c9cf893bb589d5e3ae3979392eeb3962b3e635c5457b4e
7
+ data.tar.gz: ae1f643f25fe548a4dd733f888801373a5e9512e42f6f5e7766c2326114b48510d3658a6ad87e0779c53ac57616cb5ba2d53d4481f5e813e06daeeef4706991e
data/lib/city.rb CHANGED
@@ -16,7 +16,7 @@ class City
16
16
 
17
17
  field :deleted_at, type: Time
18
18
  def self.all
19
- self.where( deleted_at: nil ).order_by( name: :desc )
19
+ self.where( deleted_at: nil, is_active: true ).order_by( name: :desc )
20
20
  end
21
21
 
22
22
  belongs_to :country, :optional => true
@@ -27,7 +27,7 @@ class City
27
27
  has_many :reports
28
28
  has_many :venues
29
29
  has_many :videos
30
- has_many :tags
30
+ has_and_belongs_to_many :tags
31
31
 
32
32
  has_many :current_users, :class_name => '::IshModels::UserProfile', :inverse_of => :current_city
33
33
  has_many :newsitems
@@ -39,6 +39,7 @@ class City
39
39
  embeds_many :features
40
40
 
41
41
  field :calendar_frame, :type => String
42
+ field :is_active, type: Boolean, default: true
42
43
 
43
44
  default_scope ->{ order_by({ :name => :asc }) }
44
45
 
data/lib/gallery.rb CHANGED
@@ -47,7 +47,7 @@ class Gallery
47
47
 
48
48
  has_many :photos
49
49
 
50
- belongs_to :tag, :optional => true
50
+ has_and_belongs_to_many :tags
51
51
  belongs_to :city, :optional => true
52
52
  belongs_to :venue, :optional => true
53
53
 
data/lib/report.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Report
1
+ class Report
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
4
 
@@ -44,11 +44,11 @@ class Report
44
44
  field :issue
45
45
  field :subhead
46
46
 
47
- belongs_to :tag, :optional => true
48
47
  belongs_to :city, :optional => true
49
48
  belongs_to :site, :optional => true
50
49
  belongs_to :cities_user, :optional => true
51
50
 
51
+ has_and_belongs_to_many :tags
52
52
  has_and_belongs_to_many :venues
53
53
 
54
54
  has_one :photo
@@ -81,13 +81,13 @@ class Report
81
81
  end
82
82
 
83
83
  def self.not_tagged
84
- Report.where( :tag_id => nil, :city => nil )
84
+ Report.where( :tag_ids => nil, :city => nil )
85
85
  end
86
86
 
87
87
  def self.for_homepage args
88
88
  begin
89
89
  tag_ids = args[:main_tag].children_tags.map { |tag| tag._id } + [ args[:main_tag]._id ]
90
- return Report.where( :tag_id.in => tag_ids ).page args[:page]
90
+ return Report.where( :tag_ids.in => tag_ids ).page args[:page]
91
91
  rescue
92
92
  return Report.page args[:page]
93
93
  end
@@ -138,10 +138,6 @@ class Report
138
138
  end
139
139
  end
140
140
 
141
- def self.not_tagged
142
- Report.where( :tag_id => nil, :city => nil )
143
- end
144
-
145
141
  def venue
146
142
  self.venues[0] || nil
147
143
  end
data/lib/tag.rb CHANGED
@@ -16,10 +16,6 @@ class Tag
16
16
 
17
17
  field :weight, :type => Integer, :default => 10
18
18
 
19
- has_many :reports
20
- has_many :galleries
21
- has_many :videos
22
-
23
19
  has_many :children_tags, :class_name => 'Tag', :inverse_of => :parent_tag
24
20
  belongs_to :parent_tag, :class_name => 'Tag', :inverse_of => :children_tags, :optional => true
25
21
 
@@ -31,6 +27,10 @@ class Tag
31
27
  belongs_to :city, :optional => true
32
28
 
33
29
  has_and_belongs_to_many :venues
30
+ has_and_belongs_to_many :cities
31
+ has_and_belongs_to_many :galleries
32
+ has_and_belongs_to_many :reports
33
+ has_and_belongs_to_many :videos
34
34
 
35
35
  default_scope ->{
36
36
  where({ :is_public => true, :is_trash => false }).order_by({ :name => :asc })
data/lib/video.rb CHANGED
@@ -22,14 +22,14 @@ class Video
22
22
  field :youtube_id, :type => String
23
23
  # validates :youtube_id, :uniqueness => true, :presence => true
24
24
 
25
- belongs_to :tag, :optional => true
25
+ has_and_belongs_to_many :tags
26
26
  belongs_to :city, :optional => true
27
27
  belongs_to :site, :optional => true
28
28
  has_many :newsitems
29
29
 
30
30
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile', :inverse_of => :videos
31
31
 
32
- accepts_nested_attributes_for :site, :tag, :city
32
+ accepts_nested_attributes_for :site, :tags, :city
33
33
 
34
34
  def self.list
35
35
  [['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
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.113
4
+ version: 0.0.33.118
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox