app/uploaders/bio_picture_uploader.rb
#
# Use a combination of the person's name for the id of the image
#
Use a combination of the person's name for the id of the image
Use a combination of the person ' s name for the id of the image
def public_id
    publicid = common_root_path + '/'
    if model.is_a?(SurveyResponse)
      details = model.survey_respondent_detail
      if details
        hasher = Hashids.new(SALT, 4)
        publicid += hasher.encode(details.id)
        publicid += "_"
      else
        publicid += 'response'
      end
      publicid += '_' + model.id.to_s
    else  
      if ((defined? model.person) && model.person)
        hasher = Hashids.new(SALT, 4)
        publicid += hasher.encode(model.person.id)
        publicid += '_' + model.person.id.to_s
      else
        publicid += 'default_bio_image'
        publicid += '_' + model.id.to_s
      end
    end
    publicid.gsub(/[?!&\s+]/, '')
  end
def public_id publicid = common_root_path + '/' if model . is_a? ( SurveyResponse ) details = model . survey_respondent_detail if details hasher = Hashids . new ( SALT , 4 ) publicid += hasher . encode ( details . id ) publicid += "_" else publicid += 'response' end publicid += '_' + model . id . to_s else if ( ( defined? model . person ) && model . person ) hasher = Hashids . new ( SALT , 4 ) publicid += hasher . encode ( model . person . id ) publicid += '_' + model . person . id . to_s else publicid += 'default_bio_image' publicid += '_' + model . id . to_s end end publicid . gsub ( / [?!& \s +] / , '' ) end
Use a combination of the person's name for the id of the image
Use a combination of the person ' s name for the id of the image