kirgudu_refs 0.0.8 → 0.0.9

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/kirgudu_refs/base_controller.rb +14 -0
  3. data/app/controllers/kirgudu_refs/finances/banks_controller.rb +358 -0
  4. data/app/controllers/kirgudu_refs/globe/cities_controller.rb +374 -0
  5. data/app/controllers/kirgudu_refs/globe/continents_controller.rb +100 -0
  6. data/app/controllers/kirgudu_refs/globe/countries_controller.rb +228 -0
  7. data/app/controllers/kirgudu_refs/globe/regions_controller.rb +321 -0
  8. data/app/controllers/kirgudu_refs/globe/states_controller.rb +217 -0
  9. data/app/controllers/kirgudu_refs/globe/subway_lines_controller.rb +58 -0
  10. data/app/controllers/kirgudu_refs/globe/subway_stations_controller.rb +117 -0
  11. data/app/controllers/kirgudu_refs/globe/timezones_controller.rb +102 -0
  12. data/app/controllers/kirgudu_refs/it/encodings_controller.rb +75 -0
  13. data/app/controllers/kirgudu_refs/it/hosting_types_controller.rb +64 -0
  14. data/app/controllers/kirgudu_refs/it/operating_system_families_controller.rb +112 -0
  15. data/app/controllers/kirgudu_refs/it/operating_systems_controller.rb +145 -0
  16. data/app/controllers/kirgudu_refs/it/processor_architectures_controller.rb +78 -0
  17. data/app/controllers/kirgudu_refs/it/top_level_domains_controller.rb +65 -0
  18. data/app/controllers/kirgudu_refs/it/website_types_controller.rb +63 -0
  19. data/app/controllers/kirgudu_refs/national/currencies_controller.rb +190 -0
  20. data/app/controllers/kirgudu_refs/national/languages_controller.rb +109 -0
  21. data/app/controllers/kirgudu_refs/shops/manufacturers_controller.rb +128 -0
  22. data/app/models/kirgudu_refs/concerns/models/bank_id.rb +48 -0
  23. data/app/models/kirgudu_refs/concerns/models/capital_id.rb +36 -0
  24. data/app/models/kirgudu_refs/concerns/models/city_id.rb +35 -0
  25. data/app/models/kirgudu_refs/concerns/models/continent_id.rb +37 -0
  26. data/app/models/kirgudu_refs/concerns/models/country_id.rb +37 -0
  27. data/app/models/kirgudu_refs/concerns/models/currency_id.rb +51 -0
  28. data/app/models/kirgudu_refs/concerns/models/encoding_id.rb +26 -0
  29. data/app/models/kirgudu_refs/concerns/models/language_id.rb +31 -0
  30. data/app/models/kirgudu_refs/concerns/models/manufacturer_id.rb +23 -0
  31. data/app/models/kirgudu_refs/concerns/models/operating_system_family_id.rb +23 -0
  32. data/app/models/kirgudu_refs/concerns/models/operating_system_id.rb +22 -0
  33. data/app/models/kirgudu_refs/concerns/models/processor_architecture_id.rb +24 -0
  34. data/app/models/kirgudu_refs/concerns/models/region_id.rb +34 -0
  35. data/app/models/kirgudu_refs/concerns/models/state_id.rb +33 -0
  36. data/app/models/kirgudu_refs/concerns/models/territory_area.rb +30 -0
  37. data/app/models/kirgudu_refs/concerns/models/territory_population.rb +30 -0
  38. data/app/models/kirgudu_refs/finances/bank.rb +8 -12
  39. data/app/models/kirgudu_refs/globe/city.rb +13 -29
  40. data/app/models/kirgudu_refs/globe/continent.rb +6 -15
  41. data/app/models/kirgudu_refs/globe/country.rb +20 -26
  42. data/app/models/kirgudu_refs/globe/region.rb +13 -26
  43. data/app/models/kirgudu_refs/globe/state.rb +12 -21
  44. data/app/models/kirgudu_refs/globe/subway_line.rb +4 -4
  45. data/app/models/kirgudu_refs/globe/subway_station.rb +4 -5
  46. data/app/models/kirgudu_refs/globe/timezone.rb +7 -8
  47. data/app/models/kirgudu_refs/it/encoding.rb +3 -4
  48. data/app/models/kirgudu_refs/it/hosting_type.rb +5 -11
  49. data/app/models/kirgudu_refs/it/operating_system.rb +8 -14
  50. data/app/models/kirgudu_refs/it/operating_system_family.rb +6 -18
  51. data/app/models/kirgudu_refs/it/processor_architecture.rb +5 -11
  52. data/app/models/kirgudu_refs/it/top_level_domain.rb +3 -3
  53. data/app/models/kirgudu_refs/it/website_type.rb +5 -12
  54. data/app/models/kirgudu_refs/national/currency.rb +7 -10
  55. data/app/models/kirgudu_refs/national/language.rb +7 -11
  56. data/app/models/kirgudu_refs/shops/manufacturer.rb +7 -13
  57. data/config/locales/kirgudu_refs.en.yml +321 -0
  58. data/config/locales/kirgudu_refs.ru.yml +321 -0
  59. metadata +44 -8
  60. data/app/helpers/kirgudu_refs/application_helper.rb +0 -4
  61. data/app/helpers/kirgudu_refs/model_basic_properties.rb +0 -261
@@ -0,0 +1,30 @@
1
+ module KirguduRefs
2
+ module Concerns::Models::TerritoryArea
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_query :query_add_territory_area
7
+
8
+ scope :with_area_me, lambda { |value| where { area >= value } if value }
9
+ scope :with_area_le, lambda { |value| where { area <= value } if value }
10
+
11
+ scope :with_area_m, lambda { |value| where { area > value } if value }
12
+ scope :with_area_l, lambda { |value| where { area < value } if value }
13
+
14
+ end
15
+
16
+ def capital_name
17
+ self.capital.name if self.capital
18
+ end
19
+
20
+ module ClassMethods
21
+ def query_add_territory_area(query, filters)
22
+ query
23
+ .with_area_me(filters[:area_me])
24
+ .with_area_le(filters[:area_le])
25
+ .with_area_m(filters[:area_m])
26
+ .with_area_l(filters[:area_l])
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module KirguduRefs
2
+ module Concerns::Models::TerritoryPopulation
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_query :query_add_territory_population
7
+
8
+ scope :with_population_me, lambda { |value| where { population >= value } if value }
9
+ scope :with_population_le, lambda { |value| where { population <= value } if value }
10
+
11
+ scope :with_population_m, lambda { |value| where { population > value } if value }
12
+ scope :with_population_l, lambda { |value| where { population < value } if value }
13
+
14
+ end
15
+
16
+ def capital_name
17
+ self.capital.name if self.capital
18
+ end
19
+
20
+ module ClassMethods
21
+ def query_add_territory_population(query, filters)
22
+ query
23
+ .with_population_me(filters[:population_me])
24
+ .with_population_le(filters[:population_le])
25
+ .with_population_m(filters[:population_m])
26
+ .with_population_l(filters[:population_l])
27
+ end
28
+ end
29
+ end
30
+ end
@@ -7,25 +7,25 @@ module KirguduRefs
7
7
 
8
8
  ########################################## RELATIONS ########################################
9
9
 
10
- include ::KirguduBase::Models::BasicProperties::Portal
11
- include ::KirguduBase::Models::BasicProperties::CreatedBy
12
- include ::KirguduBase::Models::BasicProperties::UpdatedBy
10
+ include ::KirguduBase::Concerns::Models::PortalId
11
+ include ::KirguduBase::Concerns::Models::CreatedBy
12
+ include ::KirguduBase::Concerns::Models::UpdatedBy
13
+ include ::KirguduBase::Concerns::Models::Name
13
14
 
14
- include ::KirguduRefs::ModelBasicProperties::CountryID
15
- include ::KirguduRefs::ModelBasicProperties::StateID
16
- include ::KirguduRefs::ModelBasicProperties::CityID
15
+ include ::KirguduRefs::Concerns::Models::CountryId
16
+ include ::KirguduRefs::Concerns::Models::StateId
17
+ include ::KirguduRefs::Concerns::Models::CityId
17
18
 
18
19
  ########################################## VALIDATIONS #######################################
19
20
 
20
21
 
21
- validates_presence_of :name, :bik, :correspondent_account
22
+ validates_presence_of :bik, :correspondent_account
22
23
  validates_uniqueness_of :name, :bik, :correspondent_account, scope: :portal_id, case_sensitive: false
23
24
  validates_uniqueness_of :short_name, scope: :portal_id, case_sensitive: false, allow_blank: true
24
25
  validates_uniqueness_of :registration_number, scope: :portal_id, allow_nil: true
25
26
 
26
27
  validates_length_of :bik, is: 9
27
28
  validates_length_of :correspondent_account, is: 20
28
- validates_length_of :name, maximum: 180
29
29
  validates_length_of :short_name, maximum: 128, allow_blank: true
30
30
  validates_length_of :registration_number, maximum: 40, allow_blank: true
31
31
  validates_length_of :ogrn, is: 13, allow_blank: true
@@ -40,7 +40,6 @@ module KirguduRefs
40
40
 
41
41
  ######################################### SCOPES #############################################
42
42
 
43
- include ::KirguduBase::Models::Scopes::WithName
44
43
 
45
44
  scope :with_capital_min, lambda { |value| where { authorised_capital >= value } if value }
46
45
  scope :with_capital_max, lambda { |value| where { authorised_capital <= value } if value }
@@ -96,9 +95,6 @@ module KirguduRefs
96
95
  .with_capital_min(filters[:capital_max])
97
96
  .with_foundation_year_min(filters[:foundation_year_min])
98
97
  .with_foundation_year_max(filters[:foundation_year_max])
99
- .by_country(filters[:country_id])
100
- .by_state(filters[:state_id])
101
- .by_city(filters[:city_id])
102
98
 
103
99
  super(query, filters)
104
100
  end
@@ -4,23 +4,25 @@ module KirguduRefs
4
4
 
5
5
  ########################################## RELATIONS ########################################
6
6
 
7
- include ::KirguduBase::Models::BasicProperties::Portal
8
- include ::KirguduBase::Models::BasicProperties::CreatedBy
9
- include ::KirguduBase::Models::BasicProperties::UpdatedBy
7
+ include ::KirguduBase::Concerns::Models::PortalId
8
+ include ::KirguduBase::Concerns::Models::CreatedBy
9
+ include ::KirguduBase::Concerns::Models::UpdatedBy
10
+ include ::KirguduBase::Concerns::Models::Name
11
+ include ::KirguduBase::Concerns::Models::Slug
12
+
13
+ include ::KirguduRefs::Concerns::Models::CountryId
14
+ include ::KirguduRefs::Concerns::Models::StateId
15
+ include ::KirguduRefs::Concerns::Models::RegionId
16
+
17
+ include ::KirguduRefs::Concerns::Models::TerritoryPopulation
18
+ include ::KirguduRefs::Concerns::Models::TerritoryArea
10
19
 
11
- include ::KirguduRefs::ModelBasicProperties::CountryID
12
- include ::KirguduRefs::ModelBasicProperties::StateID
13
- include ::KirguduRefs::ModelBasicProperties::RegionID
14
20
 
15
21
  ########################################## VALIDATIONS #######################################
16
22
 
17
- validates_presence_of :name, :country_id, :state_id, :slug
23
+ validates_presence_of :country_id, :state_id, :slug
18
24
  validates_uniqueness_of :name, :slug, scope: :state_id
19
25
 
20
- validates_length_of :name, maximum: 128, allow_blank: true
21
- validates_length_of :slug, maximum: 128, allow_blank: true
22
- validates_slug_format_of :slug, allow_blank: true
23
-
24
26
  validates_length_of :meta_keywords, maximum: 200, allow_blank: true
25
27
  validates_length_of :meta_description, maximum: 200, allow_blank: true
26
28
 
@@ -28,14 +30,7 @@ module KirguduRefs
28
30
 
29
31
  ########################################### SCOPES #########################################
30
32
 
31
- include ::KirguduBase::Models::Scopes::WithName
32
- include ::KirguduBase::Models::Scopes::WithSlug
33
-
34
33
  scope :with_is_active, lambda { |value| where(is_active: value) if value }
35
- scope :with_area_min, lambda { |value| where { area >= value } if value }
36
- scope :with_area_max, lambda { |value| where { area <= value } if value }
37
- scope :with_population_min, lambda { |value| where { population >= value } if value }
38
- scope :with_population_max, lambda { |value| where { population <= value } if value }
39
34
 
40
35
  scope :with_keyword, lambda { |value|
41
36
  if value
@@ -49,23 +44,12 @@ module KirguduRefs
49
44
  filters ||= {}
50
45
 
51
46
  query = query
52
- .with_area_min(filters[:area_min])
53
- .with_area_max(filters[:area_max])
54
- .with_population_min(filters[:population_min])
55
- .with_population_max(filters[:population_max])
56
- .by_country(filters[:country_id])
57
- .by_state(filters[:state_id])
58
- .by_region(filters[:region_id])
59
47
  .with_is_active(filters[:is_active])
60
48
 
61
49
  super(query, filters)
62
50
  end
63
51
 
64
52
 
65
- def capital_name
66
- capital.name if capital
67
- end
68
-
69
53
  def name_with_country_name
70
54
  "#{name} (#{country_name})"
71
55
  end
@@ -1,19 +1,17 @@
1
1
  module KirguduRefs
2
2
  class Globe::Continent < ::KirguduRefs::BaseModel
3
3
 
4
- include ::KirguduBase::Models::BasicProperties::Portal
5
- include ::KirguduBase::Models::BasicProperties::CreatedBy
6
- include ::KirguduBase::Models::BasicProperties::UpdatedBy
4
+ include ::KirguduBase::Concerns::Models::PortalId
5
+ include ::KirguduBase::Concerns::Models::CreatedBy
6
+ include ::KirguduBase::Concerns::Models::UpdatedBy
7
+ include ::KirguduBase::Concerns::Models::Name
8
+ include ::KirguduBase::Concerns::Models::Slug
7
9
 
8
10
  ########################################## VALIDATIONS #######################################
9
11
 
10
- validates_presence_of :name, :slug, :code
12
+ validates_presence_of :code
11
13
  validates_uniqueness_of :name, :slug, :code, case_sensitive: false, scope: :portal_id
12
14
 
13
- validates_length_of :name, maximum: 128
14
- validates_length_of :slug, maximum: 128
15
- validates_slug_format_of :slug, allow_blank: true
16
-
17
15
  validates_length_of :code, is: 2, allow_blank: true
18
16
 
19
17
  validates_length_of :meta_keywords, maximum: 200, allow_blank: true
@@ -22,8 +20,6 @@ module KirguduRefs
22
20
 
23
21
  ########################################### SCOPES #########################################
24
22
 
25
- include ::KirguduBase::Models::Scopes::WithName
26
- include ::KirguduBase::Models::Scopes::WithSlug
27
23
 
28
24
  scope :with_keyword, lambda { |value|
29
25
  if value
@@ -41,13 +37,8 @@ module KirguduRefs
41
37
  super(query, filters)
42
38
  end
43
39
 
44
- def capital_name
45
- capital.name if capital
46
- end
47
-
48
40
  private
49
41
  def normalize_values_before_validation
50
-
51
42
  self.name.capitalize!
52
43
  super
53
44
  end
@@ -4,18 +4,6 @@ module KirguduRefs
4
4
 
5
5
  ########################################## RELATIONS ########################################
6
6
 
7
- include ::KirguduBase::Models::BasicProperties::Portal
8
- include ::KirguduBase::Models::BasicProperties::CreatedBy
9
- include ::KirguduBase::Models::BasicProperties::UpdatedBy
10
-
11
- include ::KirguduRefs::ModelBasicProperties::CountryID
12
- include ::KirguduRefs::ModelBasicProperties::StateID
13
- include ::KirguduRefs::ModelBasicProperties::RegionID
14
- include ::KirguduRefs::ModelBasicProperties::ContinentID
15
-
16
- include ::KirguduRefs::ModelBasicProperties::CurrencyID
17
-
18
- belongs_to :capital, class_name: ::KirguduRefs::Globe::City, foreign_key: :capital_id
19
7
  #belongs_to :image, class_name: ::ErpZone::Common::Image, foreign_key: :image_id
20
8
 
21
9
  has_many :states, class_name: ::KirguduRefs::Globe::State, foreign_key: :country_id, dependent: :destroy
@@ -23,6 +11,24 @@ module KirguduRefs
23
11
  has_many :cities, class_name: ::KirguduRefs::Globe::City, foreign_key: :country_id, dependent: :destroy
24
12
  has_many :timezones, class_name: ::KirguduRefs::Globe::Timezone, foreign_key: :country_id, dependent: :nullify
25
13
 
14
+ ########################################## CONCERNS ########################################
15
+
16
+ include ::KirguduBase::Concerns::Models::PortalId
17
+ include ::KirguduBase::Concerns::Models::CreatedBy
18
+ include ::KirguduBase::Concerns::Models::UpdatedBy
19
+
20
+ include ::KirguduRefs::Concerns::Models::CountryId
21
+ include ::KirguduRefs::Concerns::Models::StateId
22
+ include ::KirguduRefs::Concerns::Models::RegionId
23
+ include ::KirguduRefs::Concerns::Models::ContinentId
24
+
25
+ include ::KirguduRefs::Concerns::Models::CurrencyId
26
+
27
+ include ::KirguduRefs::Concerns::Models::CapitalId
28
+
29
+ include ::KirguduRefs::Concerns::Models::TerritoryPopulation
30
+ include ::KirguduRefs::Concerns::Models::TerritoryArea
31
+
26
32
 
27
33
  ########################################## VALIDATIONS #######################################
28
34
 
@@ -30,8 +36,6 @@ module KirguduRefs
30
36
  validates_uniqueness_of :name, :slug, :iso2, case_sensitive: false, scope: :portal_id
31
37
 
32
38
  validates_length_of :name, maximum: 128
33
- validates_length_of :slug, maximum: 128
34
- validates_slug_format_of :slug, allow_blank: true
35
39
 
36
40
  validates_length_of :iso2, is: 2, allow_blank: true
37
41
  validates_length_of :iso3, is: 3, allow_blank: true
@@ -43,14 +47,11 @@ module KirguduRefs
43
47
 
44
48
  ########################################### SCOPES #########################################
45
49
 
46
- include ::KirguduBase::Models::Scopes::WithName
47
- include ::KirguduBase::Models::Scopes::WithSlug
48
-
49
- scope :by_capital, lambda { |value| where(capital_id: value) if value }
50
50
 
51
51
  scope :with_area_min, lambda { |value| where { area >= value } if value }
52
- scope :with_is_active, lambda { |value| where(is_active: value) if value }
52
+ scope :with_is_active, lambda { |value| where( is_active: value) if value }
53
53
  scope :with_area_max, lambda { |value| where { area <= value } if value }
54
+ scope :with_area_min, lambda { |value| where { area >= value } if value }
54
55
  scope :with_population_min, lambda { |value| where { population >= value } if value }
55
56
  scope :with_population_max, lambda { |value| where { population <= value } if value }
56
57
 
@@ -66,13 +67,6 @@ module KirguduRefs
66
67
  filters ||= {}
67
68
 
68
69
  query = query
69
- .with_area_min(filters[:area_min])
70
- .with_area_max(filters[:area_max])
71
- .with_population_min(filters[:population_min])
72
- .with_population_max(filters[:population_max])
73
- .by_currency(filters[:currency_id])
74
- .by_capital(filters[:capital_id])
75
- .by_continent(filters[:continent_id])
76
70
  .with_is_active(filters[:is_active])
77
71
 
78
72
  super(query, filters)
@@ -4,17 +4,21 @@ module KirguduRefs
4
4
 
5
5
  ########################################## RELATIONS ########################################
6
6
 
7
- include ::KirguduBase::Models::BasicProperties::Portal
8
- include ::KirguduBase::Models::BasicProperties::CreatedBy
9
- include ::KirguduBase::Models::BasicProperties::UpdatedBy
7
+ include ::KirguduBase::Concerns::Models::PortalId
8
+ include ::KirguduBase::Concerns::Models::CreatedBy
9
+ include ::KirguduBase::Concerns::Models::UpdatedBy
10
10
 
11
- include ::KirguduRefs::ModelBasicProperties::CountryID
12
- include ::KirguduRefs::ModelBasicProperties::StateID
13
- include ::KirguduRefs::ModelBasicProperties::RegionID
11
+ include ::KirguduBase::Concerns::Models::Name
12
+ include ::KirguduBase::Concerns::Models::Slug
14
13
 
15
- include ::KirguduRefs::ModelBasicProperties::CountryID
16
- include ::KirguduRefs::ModelBasicProperties::StateID
17
- include ::KirguduRefs::ModelBasicProperties::CapitalID
14
+ include ::KirguduRefs::Concerns::Models::CountryId
15
+ include ::KirguduRefs::Concerns::Models::StateId
16
+ include ::KirguduRefs::Concerns::Models::RegionId
17
+
18
+ include ::KirguduRefs::Concerns::Models::CapitalId
19
+
20
+ include ::KirguduRefs::Concerns::Models::TerritoryPopulation
21
+ include ::KirguduRefs::Concerns::Models::TerritoryArea
18
22
 
19
23
  has_many :cities, class_name: ::KirguduRefs::Globe::City, foreign_key: :region_id
20
24
 
@@ -31,17 +35,7 @@ module KirguduRefs
31
35
 
32
36
  ######################################### SCOPES #############################################
33
37
 
34
- include ::KirguduBase::Models::Scopes::WithName
35
- include ::KirguduBase::Models::Scopes::WithSlug
36
-
37
-
38
- scope :by_capital, lambda { |value| where(capital_id: value) if value }
39
-
40
38
  scope :with_is_active, lambda { |value| where(is_active: value) if value }
41
- scope :with_area_min, lambda { |value| where { area >= value } if value }
42
- scope :with_area_max, lambda { |value| where { area <= value } if value }
43
- scope :with_population_min, lambda { |value| where { population >= value } if value }
44
- scope :with_population_max, lambda { |value| where { population <= value } if value }
45
39
 
46
40
 
47
41
  scope :with_keyword, lambda { |value|
@@ -56,13 +50,6 @@ module KirguduRefs
56
50
  filters ||= {}
57
51
 
58
52
  query = query
59
- .with_area_min(filters[:area_min])
60
- .with_area_max(filters[:area_max])
61
- .with_population_min(filters[:population_min])
62
- .with_population_max(filters[:population_max])
63
- .by_country(filters[:country_id])
64
- .by_capital(filters[:capital_id])
65
- .by_state(filters[:state_id])
66
53
  .with_is_active(filters[:is_active])
67
54
 
68
55
  super(query, filters)
@@ -4,42 +4,39 @@ module KirguduRefs
4
4
 
5
5
  ########################################## RELATIONS ########################################
6
6
 
7
- include ::KirguduBase::Models::BasicProperties::Portal
8
- include ::KirguduBase::Models::BasicProperties::CreatedBy
9
- include ::KirguduBase::Models::BasicProperties::UpdatedBy
7
+ include ::KirguduBase::Concerns::Models::PortalId
8
+ include ::KirguduBase::Concerns::Models::CreatedBy
9
+ include ::KirguduBase::Concerns::Models::UpdatedBy
10
+ include ::KirguduBase::Concerns::Models::Name
11
+ include ::KirguduBase::Concerns::Models::Slug
10
12
 
11
13
 
12
- include ::KirguduRefs::ModelBasicProperties::CountryID
13
- include ::KirguduRefs::ModelBasicProperties::CapitalID
14
+ include ::KirguduRefs::Concerns::Models::CountryId
15
+ include ::KirguduRefs::Concerns::Models::CapitalId
16
+
17
+ include ::KirguduRefs::Concerns::Models::TerritoryPopulation
18
+ include ::KirguduRefs::Concerns::Models::TerritoryArea
19
+
14
20
 
15
21
  has_many :regions, class_name: ::KirguduRefs::Globe::Region, foreign_key: :state_id
16
22
  has_many :cities, class_name: ::KirguduRefs::Globe::City, foreign_key: :region_id
17
23
 
18
24
  ########################################## VALIDATIONS #######################################
19
25
 
20
- validates_presence_of :name, :country_id, :slug
26
+ validates_presence_of :country_id
21
27
  validates_uniqueness_of :name, scope: :country_id, case_sensitive: false
22
28
  validates_uniqueness_of :slug, scope: :country_id, case_sensitive: false
23
29
 
24
- validates_length_of :name, maximum: 128, allow_blank: true
25
- validates_length_of :slug, maximum: 128, allow_blank: true
26
- validates_slug_format_of :slug, allow_blank: true
27
30
 
28
31
  validates_length_of :meta_keywords, maximum: 200, allow_blank: true
29
32
  validates_length_of :meta_description, maximum: 200, allow_blank: true
30
33
 
31
34
  ######################################### SCOPES #############################################
32
35
 
33
- include ::KirguduBase::Models::Scopes::WithName
34
- include ::KirguduBase::Models::Scopes::WithSlug
35
36
 
36
37
  scope :by_capital, lambda { |value| where(capital_id: value) if value }
37
38
 
38
39
  scope :with_is_active, lambda { |value| where(is_active: value) if value }
39
- scope :with_area_min, lambda { |value| where { area >= value } if value }
40
- scope :with_area_max, lambda { |value| where { area <= value } if value }
41
- scope :with_population_min, lambda { |value| where { population >= value } if value }
42
- scope :with_population_max, lambda { |value| where { population <= value } if value }
43
40
 
44
41
  scope :with_keyword, lambda { |value|
45
42
  if value
@@ -60,12 +57,6 @@ module KirguduRefs
60
57
  filters ||= {}
61
58
 
62
59
  query = query
63
- .with_area_min(filters[:area_min])
64
- .with_area_max(filters[:area_max])
65
- .with_population_min(filters[:population_min])
66
- .with_population_max(filters[:population_max])
67
- .by_country(filters[:country_id])
68
- .by_capital(filters[:capital_id])
69
60
  .with_car_code(filters[:car_code])
70
61
  .with_is_active(filters[:is_active])
71
62