Skip to content

Instantly share code, notes, and snippets.

@mileszs
Created December 11, 2009 16:05
Show Gist options
  • Select an option

  • Save mileszs/254296 to your computer and use it in GitHub Desktop.

Select an option

Save mileszs/254296 to your computer and use it in GitHub Desktop.
# @tickets is an array of ActiveRecord objects
# The numbers against which the timeframe_id is getting checked
# correspond to IDs for specific timeframes in the database
# FIXME: Do not leave this in the controller.
@emergency = @tickets.select {|t| t.timeframe_id == 1}
@four_hours = @tickets.select {|t| t.timeframe_id == 2}
@next_bd = @tickets.select {|t| t.timeframe_id == 3}
@two_days = @tickets.select {|t| t.timeframe_id == 4}
@week = @tickets.select {|t| t.timeframe_id == 5}
@specific = @tickets.select {|t| t.timeframe_id == 6}
# FIXME: Do not leave this in the controller.
@general = @tickets.select {|t| t.ticket_type_id == 3 }
@recurring = @tickets.select { |t| t.ticket_type_id == 6 }
@sub = @tickets.select { |t| t.ticket_type_id == 5 }
@nvision = @tickets.select { |t| t.ticket_type_id == 4 }
@email = @tickets.select { |t| t.ticket_type_id == 1 }
@phone = @tickets.select { |t| t.ticket_type_id == 2 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment