countries_regions_and_cities_by_pete 0.3.0 → 0.3.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c639a777560483526b6171998059f9b979b63804e54af296ec3653ceccc00e9b
|
4
|
+
data.tar.gz: 5c5e6a07cb146258d5fd86788d63f0b580a97757d397ad2dd4f488e60cab150e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d82dc05ac4221be0b7d50712d6607d081b3e49a671fd45cf5fbdda5e90cf27a0aaccb0e1ad89d5e58a9e1989245c35301cfbbc5e560e80dfcc6381486b3c734f
|
7
|
+
data.tar.gz: ce6f6d77dcd1fce62e01c229daf9d7a0ba5e95c850d3d839a396df52c82f23a9dcbf911aa4d770622af9d21d50829592cdec0e2a99bded03e5cc18598760dd76
|
data/README.md
CHANGED
@@ -40,20 +40,32 @@ bundle exec rake db:create
|
|
40
40
|
bundle exec rails g scaffold Place name:string description:text
|
41
41
|
```
|
42
42
|
|
43
|
-
4.
|
43
|
+
4. Add this line to your application's Gemfile:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
gem 'countries_regions_and_cities_by_pete'
|
47
|
+
```
|
48
|
+
|
49
|
+
5. Go to your application's directory in Terminal and run:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
bundle install
|
53
|
+
```
|
54
|
+
|
55
|
+
6. Go to the application directory in Terminal and run the following command to install the necessary files from the gem:
|
44
56
|
|
45
57
|
|
46
58
|
```ruby
|
47
59
|
bundle exec rake 'install_countries_regions_and_cities_by_pete[Place]'
|
48
60
|
```
|
49
61
|
|
50
|
-
|
62
|
+
7. Add jQuery to your layout file: /app/views/layouts/application.html.erb
|
51
63
|
|
52
64
|
```html
|
53
65
|
<script src='/countries_regions_and_cities_by_pete/jquery-3.6.0.min.js'></script>
|
54
66
|
```
|
55
67
|
|
56
|
-
|
68
|
+
8. Paste this code to your _form.html.erb file: /app/views/places/_form.html.erb
|
57
69
|
```ruby
|
58
70
|
|
59
71
|
<div class="field" id="country_field">
|
@@ -67,7 +79,7 @@ bundle exec rake 'install_countries_regions_and_cities_by_pete[Place]'
|
|
67
79
|
</div>
|
68
80
|
|
69
81
|
```
|
70
|
-
|
82
|
+
9. Allow parameters (country,region and city) in your controller: /app/controllers/places_controller.rb
|
71
83
|
|
72
84
|
```ruby
|
73
85
|
def place_params
|
Binary file
|
@@ -1,14 +1,12 @@
|
|
1
1
|
require_relative '../peterconsuegra_recipes'
|
2
|
-
require 'fileutils'
|
3
|
-
require "tty-file"
|
4
2
|
|
5
|
-
#bundle exec rake 'install_countries_regions_and_cities_by_pete[
|
6
|
-
|
7
|
-
Dir.glob("#{Rails.root}/app/models/*.rb").each { |file| require file }
|
3
|
+
#bundle exec rake 'install_countries_regions_and_cities_by_pete[model]'
|
8
4
|
|
9
5
|
desc 'install countries_regions_and_cities required files'
|
10
6
|
task :install_countries_regions_and_cities_by_pete, [:model] do |t, args|
|
11
|
-
|
7
|
+
|
8
|
+
Dir.glob("#{Rails.root}/app/models/*.rb").each { |file| require file }
|
9
|
+
|
12
10
|
#Base routes
|
13
11
|
rails_app_folder = Dir.pwd
|
14
12
|
gem_folder = File.expand_path('../../../.', __FILE__)
|
@@ -58,6 +56,6 @@ task :install_countries_regions_and_cities_by_pete, [:model] do |t, args|
|
|
58
56
|
<%= render partial: "shared/city_select_by_pete", locals: {model: form.object.class.name, label: "City", selected_region: form.object.region, selected_country: form.object.country, selected: form.object.city} %>
|
59
57
|
</div>'.red
|
60
58
|
puts "Allow countries_regions_and_cities_by_pete globalization params in your controller #{hash['controller_file']}:".red
|
61
|
-
puts "params.require(:#{hash['model']}).permit(:city, :region, :country)".red
|
59
|
+
puts "params.require(:#{hash['model'].downcase}).permit(:city, :region, :country)".red
|
62
60
|
|
63
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: countries_regions_and_cities_by_pete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Consuegra
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- Rakefile
|
85
85
|
- bin/console
|
86
86
|
- bin/setup
|
87
|
+
- countries_regions_and_cities_by_pete-0.3.0.gem
|
87
88
|
- countries_regions_and_cities_by_pete.gemspec
|
88
89
|
- countries_regions_and_cities_by_peterconsuegra-0.2.5.gem
|
89
90
|
- lib/countries_regions_and_cities_by_pete.rb
|