Sha256: 86412549a4d1ee14b8c4d887f98cc0f18b187965ac7c35befbc4d99c0093110e

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

require 'browser'
class HelpRequest < ActiveRecord::Base

  attr_accessible(
    :current_url,
    :flash_version,
    :how_can_we_help_you,
    :javascript_enabled,
    :resolution,
    :user_agent,
    :view_port
  )

  belongs_to :user
  validates_presence_of :how_can_we_help_you,
    :message => "Please tell us about the problem or issue you are having with #{I18n.t('sufia.product_name')}."

  after_save :send_notification

  def browser_name
    parse_user_agent
    @browser.name
  end

  def platform
    parse_user_agent
    @browser.platform
  end

  private

  def parse_user_agent
    @browser ||= Browser.new(:ua => user_agent)
  end

  def send_notification
    Sufia.queue.push(NotificationWorker.new(id))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curate-0.3.1 app/models/help_request.rb