scaffold_plus 1.7.5 → 1.7.6
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d086d36b9eb62d10cb0d98dc72dd6ab7691e1394
|
4
|
+
data.tar.gz: a73dd1c0b68f5b1e09e09f6006a28db56868251f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fcc8daf9c6b5d2ecf7f2ec6e46e76bc87e2a8744f1a18ec53d3c524593c69a51fc0aca6bbea8b725744a7d346656861b212ff313f69a53918d8d771a1bd9c5c
|
7
|
+
data.tar.gz: 45e7c6988952b0377c26ec4e6b633d6988adf62ea18aba95d70a035e06f875db879000a0a15dafeb687d60890c31b53819ea10c30626347f3d633a7bed8f6965
|
@@ -10,6 +10,16 @@ module ScaffoldPlus
|
|
10
10
|
desc: 'Attribute used for storing latitude'
|
11
11
|
class_option :longitude, type: :string, default: "lng",
|
12
12
|
desc: 'Attribute used for storing longitude'
|
13
|
+
class_option :migration, type: :boolean, default: false,
|
14
|
+
desc: 'Create a migration for added attributes'
|
15
|
+
class_option :address, type: :boolean, default: true,
|
16
|
+
desc: 'Add an address field to the migration'
|
17
|
+
source_root File.expand_path('../templates', __FILE__)
|
18
|
+
|
19
|
+
def add_migration
|
20
|
+
return unless options.migration?
|
21
|
+
migration_template 'geodesic.rb', "db/migrate/#{migration_name}.rb"
|
22
|
+
end
|
13
23
|
|
14
24
|
def update_model
|
15
25
|
lat = options.latitude
|
@@ -41,6 +51,12 @@ module ScaffoldPlus
|
|
41
51
|
]
|
42
52
|
inject_into_class file, class_name, lines.join("\n")
|
43
53
|
end
|
54
|
+
|
55
|
+
protected
|
56
|
+
|
57
|
+
def migration_name
|
58
|
+
"add_geodesic_to_#{table_name}"
|
59
|
+
end
|
44
60
|
end
|
45
61
|
end
|
46
62
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class <%= migration_name.camelize %> < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :<%= table_name %>, :<%= options.latitude %>, :float
|
4
|
+
add_column :<%= table_name %>, :<%= options.longitude %>, :float
|
5
|
+
<%- if options.address? -%>
|
6
|
+
add_column :<%= table_name %>, :address, :string
|
7
|
+
<%- end -%>
|
8
|
+
add_index :<%= table_name %>, :<%= options.latitude %>
|
9
|
+
add_index :<%= table_name %>, :<%= options.longitude %>
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffold_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volker Wiegand
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/generators/scaffold_plus/geocoder_init/geocoder_init_generator.rb
|
92
92
|
- lib/generators/scaffold_plus/geocoder_init/templates/geocoder.rb
|
93
93
|
- lib/generators/scaffold_plus/geodesic/geodesic_generator.rb
|
94
|
+
- lib/generators/scaffold_plus/geodesic/templates/geodesic_migration.rb
|
94
95
|
- lib/generators/scaffold_plus/habtm/habtm_generator.rb
|
95
96
|
- lib/generators/scaffold_plus/habtm/templates/habtm_migration.rb
|
96
97
|
- lib/generators/scaffold_plus/has_many/has_many_generator.rb
|