Class: NoticesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/notices_controller.rb

Defined Under Namespace

Classes: ParamsError

Instance Method Summary collapse

Methods inherited from ApplicationController

#stored_location_for

Instance Method Details

#createObject


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/notices_controller.rb', line 9

def create
  # params[:data] if the notice came from a GET request, raw_post if it came via POST
  report = ErrorReport.new(notice_params)

  if report.valid?
    if report.should_keep?
      report.generate_notice!
      api_xml = report.notice.to_xml(:only => false, :methods => [:id]) do |xml|
       xml.url locate_url(report.notice.id, :host => Errbit::Config.host)
      end
      render :xml => api_xml
    else
      render :text => "Notice for old app version ignored"
    end
  else
    render :text => "Your API key is unknown", :status => 422
  end
end

#locateObject

Redirects a notice to the problem page. Useful when using User Information at Airbrake gem.


29
30
31
32
# File 'app/controllers/notices_controller.rb', line 29

def locate
  problem = Notice.find(params[:id]).problem
  redirect_to app_problem_path(problem.app, problem)
end