-
-
Notifications
You must be signed in to change notification settings - Fork 512
/
Copy path5-0.rb
67 lines (52 loc) · 1.1 KB
/
5-0.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
ActiveRecord::Schema.define do
create_table :posts, force: true do |t|
end
create_table :comments, force: true do |t|
t.integer :post_id
end
end
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
class PostsController < ActionController::Base
def index
Post.all.to_a
raise "foo"
end
def show
p = Post.find(params[:id])
render plain: p.id
end
end
class HelloController < ActionController::Base
def exception
raise "An unhandled exception!"
end
def reporting
render plain: Sentry.last_event_id
end
def view_exception
render inline: "<%= foo %>"
end
def view
render template: "test_template"
end
def world
render plain: "Hello World!"
end
def with_custom_instrumentation
custom_event = "custom.instrument"
ActiveSupport::Notifications.subscribe(custom_event) do |*args|
data = args[-1]
data += 1
end
ActiveSupport::Notifications.instrument(custom_event, 1)
head :ok
end
def not_found
raise ActionController::BadRequest
end
end