gmaps4rails 0.4.0 → 0.4.1
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.
- data/README.rdoc +3 -1
- data/lib/acts_as_gmappable/base.rb +3 -0
- data/test/dummy/spec/models/user_spec.rb +14 -0
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -51,7 +51,7 @@ In your controller:
|
|
51
51
|
|
52
52
|
In your view:
|
53
53
|
|
54
|
-
<%=
|
54
|
+
<%= gmaps4rails(@json) %>
|
55
55
|
|
56
56
|
Done again!
|
57
57
|
|
@@ -67,6 +67,8 @@ Done again!
|
|
67
67
|
|
68
68
|
* Geocode directly your address and retrieve coordinates.
|
69
69
|
|
70
|
+
* Auto-adjust the map to your markers
|
71
|
+
|
70
72
|
* {More details in the Wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki]
|
71
73
|
|
72
74
|
== Todo?
|
@@ -93,6 +93,9 @@ module Gmaps4rails
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def process_geocoding
|
96
|
+
#to prevent geocoding each time a save is made
|
97
|
+
return true if gmaps4rails_options[:check_process] == true && self[gmaps4rails_options[:checker]] == true
|
98
|
+
|
96
99
|
begin
|
97
100
|
coordinates = Gmaps4rails.geocode(self.gmaps4rails_address)
|
98
101
|
rescue GeocodeStatus #adress was invalid, add error to base.
|
@@ -25,6 +25,20 @@ describe "Acts as gmappable" do
|
|
25
25
|
@user.to_gmaps4rails.should == "[{\"description\": \"\",\n\"longitude\": \"5.9311119\",\n\"latitude\": \"43.1251606\",\n\"picture\": \"\",\n\"width\": \"\",\n\"height\": \"\"\n} ]"
|
26
26
|
end
|
27
27
|
|
28
|
+
it "should not geocode again after address changes if checker is true" do
|
29
|
+
@user.address = "paris, France"
|
30
|
+
@user.save
|
31
|
+
@user.latitude.should == 43.1251606
|
32
|
+
@user.longitude.should == 5.9311119
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should geocode after address changes if checker is false" do
|
36
|
+
@user.address = "paris, France"
|
37
|
+
@user.gmaps = false
|
38
|
+
@user.save
|
39
|
+
@user.latitude.should == 48.8566667
|
40
|
+
@user.longitude.should == 2.3509871
|
41
|
+
end
|
28
42
|
end
|
29
43
|
|
30
44
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmaps4rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Roth
|