Module: MapLayers::ClassMethods

Defined in:
lib/map_layers.rb

Instance Method Summary collapse

Instance Method Details

#map_layer(model_id = nil, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/map_layers.rb', line 21

def map_layer(model_id = nil, options = {})
  options.assert_valid_keys(:id, :lat, :lon, :geometry, :text)

  # converts Foo::BarController to 'bar' and FooBarsController to 'foo_bar' and AddressController to 'address'
  model_id = self.to_s.split('::').last.sub(/Controller$/, '').pluralize.singularize.underscore unless model_id

  # create the configuration
  @map_layers_config = MapLayers::Config::new(model_id, options)

  # module_eval do
  #   include MapLayers::KML
  #   include MapLayers::WFS
  #   include MapLayers::GeoRSS
  #   include MapLayers::Proxy
  #   include MapLayers::Rest
  # end

  #session :off, :only => [:kml, :wfs, :georss]

end

#map_layers_configObject



42
43
44
# File 'lib/map_layers.rb', line 42

def map_layers_config
  @map_layers_config || self.superclass.instance_variable_get('@map_layers_config')
end