Class: CatRoute

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

Instance Method Summary collapse

Instance Method Details

#cat_routes_or_neighboursObject



36
37
38
39
40
41
42
# File 'app/models/cat_route.rb', line 36

def cat_routes_or_neighbours
  if self.parent_id.present?
    CatRoute.find(self.parent_id).cat_routes
  else
    self.cat_routes
  end
end

#urlObject



26
27
28
29
30
31
32
33
34
# File 'app/models/cat_route.rb', line 26

def url
  if self.slug == ':redirect_to'
    self.html
  elsif self.slug == ':root'
      "/#{self.locale}"
  else
    "/#{self.locale}/#{self.slug}"
  end
end