Module: SirTracksAlot::Helper

Defined in:
lib/sir_tracks_alot.rb

Instance Method Summary collapse

Instance Method Details

#find_by_trackable_id(trackable_id) ⇒ Object



109
110
111
112
113
# File 'lib/sir_tracks_alot.rb', line 109

def find_by_trackable_id(trackable_id)
  parts = trackable_id.split('/')
  return unless parts.size == 3
  return part[1].constantize.find(parts[2])
end

#to_trackable_idObject



105
106
107
# File 'lib/sir_tracks_alot.rb', line 105

def to_trackable_id
  '/'+[self.class.name.underscore.pluralize, self.to_param].join('/')
end