app/controllers/apps_controller.rb
# email_at_notices is edited as a string, and stored as an array.
email_at_notices is edited as a string, and stored as an array.
email_at_notices is edited as a string and stored as an array .
def parse_email_at_notices_or_set_default
    return if params[:app].blank?
    val = params[:app][:email_at_notices]
    return if val.blank?
    email_at_notices = val.
      gsub(/-\d+/, "").
      split(",").
      map { |v| v.strip.to_i }.
      reject { |v| v == 0 }
    if email_at_notices.any?
      params[:app][:email_at_notices] = email_at_notices
    else
      default_array = params[:app][:email_at_notices] = Errbit::Config.email_at_notices
      flash[:error] = "Couldn't parse your notification frequency. Value was reset to default (#{default_array.join(', ')})."
    end
  end
def parse_email_at_notices_or_set_default return if params [ :app ] . blank? val = params [ :app ] [ :email_at_notices ] return if val . blank? email_at_notices = val . gsub ( / - \d + / , "" ) . split ( "," ) . map { | v | v . strip . to_i } . reject { | v | v == 0 } if email_at_notices . any? params [ :app ] [ :email_at_notices ] = email_at_notices else default_array = params [ :app ] [ :email_at_notices ] = Errbit :: Config . email_at_notices flash [ :error ] = "Couldn't parse your notification frequency. Value was reset to default (#{default_array.join(', ')})." end end
email_at_notices is edited as a string, and stored as an array.
email_at_notices is edited as a string and stored as an array .
# Sanitize negative values, split on comma, # strip, parse as integer, remove all '0's. # If empty, set as default and show an error message.