geopolitical 2.0.0 → 3.0.0

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
  SHA1:
3
- metadata.gz: 3fcaf0124ce75104648c84339eccf76ca9bef60d
4
- data.tar.gz: cd2c77e60f52d17b1cba1ce4cd8e0d50d394bafd
3
+ metadata.gz: 8e48641bb3edaca229ec8ee388684cff45da3612
4
+ data.tar.gz: 1cf9b43ae4f9080148b6bbd12f0ffaf0602d48d4
5
5
  SHA512:
6
- metadata.gz: bdcf8342b46bd934ef3a783f109cd5d7bc208cc56bda32fc5ebc1e62fe179d527570575af9e93784d76bb6b0aca47db4c41d871583df4c6c4a75916aea7bee3a
7
- data.tar.gz: c288bdb8c35d206f49ae6c58ee35fb252a1680f7a474daf997e07b1e69dbc2f6a85b2a7655491e4ea273ed8071cc8a09cfc4ffc7c318446ff8df17fd9edff8b9
6
+ metadata.gz: 75ec8c8ae0d7e35033e6ce0274f37c0e2b543bdca5d4e100dd97eb0bb758d761de58c24c0f2f823c88e73146e26eedb5df938987a42939276c88d940cf2e7145
7
+ data.tar.gz: 8fa9fb4416f4a07b42a4c9f17c3a2986d7650727c4dbdab898e60ea4570c1e5261de3aa782296848f441bd94cd55d80dd44ffba6bc654f24daf866b65f3175a2
@@ -41,7 +41,7 @@ class City
41
41
  def set_defaults
42
42
  self.nation ||= region.try(:nation)
43
43
  return unless City.where(slug: slug).first
44
- self.slug += "-#{region.abbr}"
44
+ self.slug += "-#{region.abbr || region.slug}"
45
45
  return unless City.where(slug: slug).first
46
46
  raise "Two cities with the same name in #{region}: '#{slug}'"
47
47
  end
@@ -9,7 +9,7 @@ module Geopolitocracy
9
9
  field :abbr, type: String
10
10
  field :nick, type: String
11
11
 
12
- field :souls, type: Fixnum # Population
12
+ field :souls, type: Integer # Population
13
13
 
14
14
  field :ascii, type: String
15
15
  field :code, type: String
@@ -23,7 +23,7 @@ module Geopolitocracy
23
23
 
24
24
  validates :name, presence: true
25
25
  validates :slug, presence: true, uniqueness: true
26
- validates :code, uniqueness: { allow_nil: true }
26
+ validates :code, uniqueness: { scope: :nation_id, allow_nil: true }
27
27
 
28
28
  index slug: 1
29
29
  index name: 1
@@ -55,7 +55,7 @@ module Geopolitocracy
55
55
  def self.search(txt, lazy = false)
56
56
  key = ActiveSupport::Inflector.transliterate(txt).gsub(/\W/, '-')
57
57
  char = lazy ? nil : '$'
58
- where(slug: /^#{key}#{char}/i)
58
+ where(slug: /^#{key.downcase}#{char}/)
59
59
  end
60
60
  end
61
61
  end
@@ -1,4 +1,4 @@
1
1
  # :nodoc:
2
2
  module Geopolitical
3
- VERSION = '2.0.0'.freeze
3
+ VERSION = '3.0.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geopolitical
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Piccinini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-05 00:00:00.000000000 Z
11
+ date: 2017-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -58,11 +58,6 @@ files:
58
58
  - app/assets/images/geopolitical/.keep
59
59
  - app/assets/javascripts/geopolitical/application.js
60
60
  - app/assets/stylesheets/geopolitical/application.css
61
- - app/controllers/geopolitical/cities_controller.rb
62
- - app/controllers/geopolitical/geopolitical_controller.rb
63
- - app/controllers/geopolitical/hoods_controller.rb
64
- - app/controllers/geopolitical/nations_controller.rb
65
- - app/controllers/geopolitical/regions_controller.rb
66
61
  - app/helpers/geopolitical/application_helper.rb
67
62
  - app/models/city.rb
68
63
  - app/models/concerns/geopolitocracy.rb
@@ -167,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
162
  version: '0'
168
163
  requirements: []
169
164
  rubyforge_project:
170
- rubygems_version: 2.5.1
165
+ rubygems_version: 2.6.11
171
166
  signing_key:
172
167
  specification_version: 4
173
168
  summary: Geopolitical models for mongoid.
@@ -1,23 +0,0 @@
1
- module Geopolitical
2
- # Cities Public Controller
3
- class CitiesController < GeopoliticalController
4
- # allow "admin"
5
- before_filter :load_relatives, only: [:new, :edit, :create, :update]
6
-
7
- def collection
8
- @cities = City.ordered.search(params[:search]).page(params[:page])
9
- end
10
-
11
- private
12
-
13
- def load_marker
14
- end
15
-
16
- def load_map
17
- end
18
-
19
- def load_relatives
20
- @regions = Region.only(:name).map { |e| [e.name, e.id] }
21
- end
22
- end
23
- end
@@ -1,17 +0,0 @@
1
- module Geopolitical
2
- # Main Geopolitical Controller
3
- class GeopoliticalController < ActionController::Base
4
- layout 'geopolitical'
5
-
6
- def index
7
- @regions = Region.all
8
- @cities = City.all
9
- end
10
-
11
- private
12
-
13
- def permitted_params
14
- # params.permit(:name, :slug)
15
- end
16
- end
17
- end
@@ -1,18 +0,0 @@
1
- module Geopolitical
2
- # Hoods Main Public Interface
3
- class HoodsController < GeopoliticalController
4
- # belongs_to :city
5
- # respond_to :html, :xml, :json
6
- before_filter :load_relatives, only: [:new, :edit, :create, :update]
7
-
8
- def collection
9
- @hoods = Hood.ordered.page(params[:page])
10
- end
11
-
12
- private
13
-
14
- def load_relatives
15
- @cities = City.only(:name).map { |e| [e.name, e.id] }
16
- end
17
- end
18
- end
@@ -1,13 +0,0 @@
1
- module Geopolitical
2
- # Nations Public Controller
3
- class NationsController < GeopoliticalController
4
- def collection
5
- @nations = Nation.ordered
6
- end
7
-
8
- # private
9
- # def permitted_params
10
- # params.permit! #require(:nation).permit!
11
- # end
12
- end
13
- end
@@ -1,16 +0,0 @@
1
- module Geopolitical
2
- # Main Regions Controller
3
- class RegionsController < GeopoliticalController
4
- before_filter :set_nations, only: [:new, :edit, :create, :update]
5
-
6
- def collection
7
- @regions = Region.ordered.page(params[:page])
8
- end
9
-
10
- private
11
-
12
- def set_nations
13
- @nations = Nation.all.map { |n| [n.name, n.id] }
14
- end
15
- end
16
- end