Class: GeoZone

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/geo_zone.rb

Direct Known Subclasses

Country

Instance Method Summary collapse

Instance Method Details

#to_jstree(element_to_count) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'app/models/geo_zone.rb', line 4

def to_jstree(element_to_count)
  hash = {}
  hash[:attributes] = { :id => "#{self.class.to_s.underscore}_#{id}", :type => 'folder' }
  hash[:data] = { :title => "#{name}<span>#{self.send(element_to_count).count}</span>", :attributes => { :class => 'big-icons', :style => 'category_picture' }}
  unless children.empty?
    hash[:children] = children.collect{ |g| g.to_jstree(element_to_count)}
  end
  hash
end