Sha256: 401a6f8ed132f14fb1ac381088ee0efa5c54ba3dded3a06fab5ed8c8daac0fb1

Contents?: true

Size: 618 Bytes

Versions: 13

Compression:

Stored size: 618 Bytes

Contents

require 'browser'
class HelpRequest < ActiveRecord::Base

  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

  def sender_email
    self.user.email
  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

13 entries across 13 versions & 1 rubygems

Version Path
curate-0.6.6 app/models/help_request.rb
curate-0.6.5 app/models/help_request.rb
curate-0.6.4 app/models/help_request.rb
curate-0.6.3 app/models/help_request.rb
curate-0.6.1 app/models/help_request.rb
curate-0.6.0 app/models/help_request.rb
curate-0.5.6 app/models/help_request.rb
curate-0.5.5 app/models/help_request.rb
curate-0.5.4 app/models/help_request.rb
curate-0.5.2 app/models/help_request.rb
curate-0.5.1 app/models/help_request.rb
curate-0.5.0 app/models/help_request.rb
curate-0.4.2 app/models/help_request.rb