Module: Slugged

Defined in:
app/models/concerns/slugged.rb

Overview

TODO:

CLEANUP - can be removed by using friendly_id properly?

Hacky way to select stations by id or slug

Instance Method Summary collapse

Instance Method Details

#select_by_slug_or_id(param) ⇒ Object



4
5
6
7
# File 'app/models/concerns/slugged.rb', line 4

def select_by_slug_or_id param
  station = select { |station| [ station.slug, station.id].include?( param ) }
  station.first if station.length.nonzero?
end