Module: MapLayers::ClassMethods

Defined in:
lib/map_layers.rb

Instance Method Summary collapse

Instance Method Details

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



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/map_layers.rb', line 28

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



49
50
51
# File 'lib/map_layers.rb', line 49

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