Module: Gmaps4rails::ActsAsGmappable::InstanceMethods
- Included in:
- ClassMethods
- Defined in:
- lib/acts_as_gmappable/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #gmaps4rails_infowindow ⇒ Object
- #gmaps4rails_marker_picture ⇒ Object
- #gmaps4rails_sidebar ⇒ Object
- #gmaps4rails_title ⇒ Object
- #process_geocoding ⇒ Object
- #to_gmaps4rails ⇒ Object
Class Method Details
.gmaps4rails_trusted_scopes ⇒ Object
161 162 163 |
# File 'lib/acts_as_gmappable/base.rb', line 161 def self.gmaps4rails_trusted_scopes [] end |
Instance Method Details
#gmaps4rails_infowindow ⇒ Object
124 125 |
# File 'lib/acts_as_gmappable/base.rb', line 124 def gmaps4rails_infowindow end |
#gmaps4rails_marker_picture ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/acts_as_gmappable/base.rb', line 153 def gmaps4rails_marker_picture { "picture" => "", "width" => "", "height" => "" } end |
#gmaps4rails_sidebar ⇒ Object
130 131 |
# File 'lib/acts_as_gmappable/base.rb', line 130 def end |
#gmaps4rails_title ⇒ Object
127 128 |
# File 'lib/acts_as_gmappable/base.rb', line 127 def gmaps4rails_title end |
#process_geocoding ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/acts_as_gmappable/base.rb', line 133 def process_geocoding #to prevent geocoding each time a save is made return true if [:check_process] == true && self[[:checker]] == true begin coordinates = Gmaps4rails.geocode(self.gmaps4rails_address) rescue GeocodeStatus #adress was invalid, add error to base. errors[:base] << [:msg] if [:validation] rescue GeocodeNetStatus => e #connection error, No need to prevent save. logger.warn(e) #TODO add customization here? else #if no exception self[[:lng_column]] = coordinates.first[:lng] self[[:lat_column]] = coordinates.first[:lat] if [:check_process] == true self[[:checker]] = true end end end |
#to_gmaps4rails ⇒ Object
165 166 167 168 169 |
# File 'lib/acts_as_gmappable/base.rb', line 165 def to_gmaps4rails json = "[" json += Gmaps4rails.create_json(self).to_s.chop #removes the extra comma json += "]" end |