repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-delayed_job/app.rb
ruby/sentry-delayed_job/app.rb
# frozen_string_literal: true require "active_job" require "active_record" require "delayed_job" require "delayed_job_active_record" require "sentry-delayed_job" # require "logger" # This connection will do for database-independent bug reports. ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") # ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Schema.define do create_table :delayed_jobs do |table| table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually. table.text :handler, null: false # YAML-encoded string of the object that will do work table.text :last_error # reason for last failure (See Note below) table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. table.datetime :locked_at # Set when a client is working on this object table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) table.string :locked_by # Who is working on this object (if locked) table.string :queue # The name of the queue this job is in table.timestamps null: true end end Sentry.init do |config| config.breadcrumbs_logger = [:sentry_logger] # replace it with your sentry dsn config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472' end class MyJob < ActiveJob::Base self.queue_adapter = :delayed_job def perform raise "foo" end end MyJob.perform_later enqueued_job = Delayed::Backend::ActiveRecord::Job.last begin enqueued_job.invoke_job rescue => e puts("active job failed because of \"#{e.message}\"") end class Foo def bar 1 / 0 end end Foo.new.delay.bar enqueued_job = Delayed::Backend::ActiveRecord::Job.last begin enqueued_job.invoke_job rescue => e puts("inline job failed because of \"#{e.message}\"") end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/resque_jobs/raise_error.rb
ruby/sentry-rails/rails-6.0/app/resque_jobs/raise_error.rb
class RaiseError @queue = :default def self.perform 1/0 end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/jobs/application_job.rb
ruby/sentry-rails/rails-6.0/app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked # Most jobs are safe to ignore if the underlying records are no longer available # discard_on ActiveJob::DeserializationError end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/jobs/error_job.rb
ruby/sentry-rails/rails-6.0/app/jobs/error_job.rb
class ErrorJob < ApplicationJob self.queue_adapter = :async def perform a = 1 b = 2 raise "Job failed" end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/workers/error_worker.rb
ruby/sentry-rails/rails-6.0/app/workers/error_worker.rb
class ErrorWorker include Sidekiq::Worker sidekiq_options retry: false def perform a = 1 raise "Worker failed" end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/delayed_jobs/error_delayed_job.rb
ruby/sentry-rails/rails-6.0/app/delayed_jobs/error_delayed_job.rb
class ErrorDelayedJob def self.perform 1/0 end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/helpers/posts_helper.rb
ruby/sentry-rails/rails-6.0/app/helpers/posts_helper.rb
module PostsHelper end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/helpers/application_helper.rb
ruby/sentry-rails/rails-6.0/app/helpers/application_helper.rb
module ApplicationHelper end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/controllers/posts_controller.rb
ruby/sentry-rails/rails-6.0/app/controllers/posts_controller.rb
class PostsController < ApplicationController before_action :set_post, only: [:show, :edit, :update, :destroy] # GET /posts # GET /posts.json def index @posts = Post.all end # GET /posts/1 # GET /posts/1.json def show @post.cover.attach( io: File.open(File.join(Rails.root, 'public', 'favicon.ico')), filename: 'favicon.ico', identify: false ) @post end # GET /posts/new def new @post = Post.new end # GET /posts/1/edit def edit end # POST /posts # POST /posts.json def create @post = Post.new(post_params) respond_to do |format| if @post.save format.html { redirect_to @post, notice: 'Post was successfully created.' } format.json { render :show, status: :created, location: @post } else format.html { render :new } format.json { render json: @post.errors, status: :unprocessable_entity } end end end # PATCH/PUT /posts/1 # PATCH/PUT /posts/1.json def update respond_to do |format| if @post.update(post_params) format.html { redirect_to @post, notice: 'Post was successfully updated.' } format.json { render :show, status: :ok, location: @post } else format.html { render :edit } format.json { render json: @post.errors, status: :unprocessable_entity } end end end # DELETE /posts/1 # DELETE /posts/1.json def destroy @post.destroy respond_to do |format| format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_post @post = Post.find(params[:id]) end # Only allow a list of trusted parameters through. def post_params params.require(:post).permit(:title, :content, :cover) end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/controllers/welcome_controller.rb
ruby/sentry-rails/rails-6.0/app/controllers/welcome_controller.rb
class WelcomeController < ApplicationController before_action :set_sentry_context def index a = 1 b = 0 a / b end def connect_trace # see the sinatra example under the `sentry-ruby` folder response = Net::HTTP.get_response(URI("http://localhost:4567/connect_trace")) render plain: response.code end def appearance end def view_error end def sidekiq_error ErrorWorker.perform_async render plain: "Remember to start sidekiq worker with '$ bundle exec sidekiq'" end def resque_error Resque.enqueue(RaiseError) render plain: "Remember to start resque worker with '$ QUEUE=* bundle exec rake resque:work'" end def delayed_job_error ErrorDelayedJob.delay.perform render plain: "Remember to start delayed_job worker with '$ bundle exec rake jobs:work'" end def job_error ErrorJob.perform_later render plain: "success" end def report_demo # @sentry_event_id = Raven.last_event_id render(status: 500) end private def set_sentry_context counter = (Sentry.get_current_scope.tags[:counter] || 0) + 1 Sentry.set_tags(counter: counter) end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/controllers/application_controller.rb
ruby/sentry-rails/rails-6.0/app/controllers/application_controller.rb
class ApplicationController < ActionController::Base end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/models/post.rb
ruby/sentry-rails/rails-6.0/app/models/post.rb
class Post < ApplicationRecord has_one_attached :cover end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/models/application_record.rb
ruby/sentry-rails/rails-6.0/app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/mailers/application_mailer.rb
ruby/sentry-rails/rails-6.0/app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/channels/appearance_channel.rb
ruby/sentry-rails/rails-6.0/app/channels/appearance_channel.rb
class AppearanceChannel < ApplicationCable::Channel def subscribed end def unsubscribed end def hello end def goodbye(data) 1 / 0 end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/channels/application_cable/channel.rb
ruby/sentry-rails/rails-6.0/app/channels/application_cable/channel.rb
module ApplicationCable class Channel < ActionCable::Channel::Base end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/app/channels/application_cable/connection.rb
ruby/sentry-rails/rails-6.0/app/channels/application_cable/connection.rb
module ApplicationCable class Connection < ActionCable::Connection::Base def connect end end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/db/seeds.rb
ruby/sentry-rails/rails-6.0/db/seeds.rb
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first)
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/db/schema.rb
ruby/sentry-rails/rails-6.0/db/schema.rb
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rails # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to # be faster and is potentially less error prone than running all of your # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2021_12_19_212232) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false t.integer "record_id", null: false t.integer "blob_id", null: false t.datetime "created_at", null: false t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end create_table "active_storage_blobs", force: :cascade do |t| t.string "key", null: false t.string "filename", null: false t.string "content_type" t.text "metadata" t.string "service_name", null: false t.bigint "byte_size", null: false t.string "checksum", null: false t.datetime "created_at", null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end create_table "active_storage_variant_records", force: :cascade do |t| t.integer "blob_id", null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end create_table "delayed_jobs", force: :cascade do |t| t.integer "priority", default: 0, null: false t.integer "attempts", default: 0, null: false t.text "handler", null: false t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" t.string "locked_by" t.string "queue" t.datetime "created_at", precision: 6 t.datetime "updated_at", precision: 6 t.index ["priority", "run_at"], name: "delayed_jobs_priority" end create_table "posts", force: :cascade do |t| t.string "title" t.text "content" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/db/migrate/20201120074001_create_posts.rb
ruby/sentry-rails/rails-6.0/db/migrate/20201120074001_create_posts.rb
class CreatePosts < ActiveRecord::Migration[6.0] def change create_table :posts do |t| t.string :title t.text :content t.timestamps end end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/db/migrate/20211219212232_create_delayed_jobs.rb
ruby/sentry-rails/rails-6.0/db/migrate/20211219212232_create_delayed_jobs.rb
class CreateDelayedJobs < ActiveRecord::Migration[6.1] def self.up create_table :delayed_jobs do |table| table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually. table.text :handler, null: false # YAML-encoded string of the object that will do work table.text :last_error # reason for last failure (See Note below) table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. table.datetime :locked_at # Set when a client is working on this object table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) table.string :locked_by # Who is working on this object (if locked) table.string :queue # The name of the queue this job is in table.timestamps null: true end add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority" end def self.down drop_table :delayed_jobs end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/db/migrate/20211002044752_create_active_storage_tables.active_storage.rb
ruby/sentry-rails/rails-6.0/db/migrate/20211002044752_create_active_storage_tables.active_storage.rb
# This migration comes from active_storage (originally 20170806125915) class CreateActiveStorageTables < ActiveRecord::Migration[5.2] def change create_table :active_storage_blobs do |t| t.string :key, null: false t.string :filename, null: false t.string :content_type t.text :metadata t.string :service_name, null: false t.bigint :byte_size, null: false t.string :checksum, null: false t.datetime :created_at, null: false t.index [ :key ], unique: true end create_table :active_storage_attachments do |t| t.string :name, null: false t.references :record, null: false, polymorphic: true, index: false t.references :blob, null: false t.datetime :created_at, null: false t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true t.foreign_key :active_storage_blobs, column: :blob_id end create_table :active_storage_variant_records do |t| t.belongs_to :blob, null: false, index: false t.string :variation_digest, null: false t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true t.foreign_key :active_storage_blobs, column: :blob_id end end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/test/application_system_test_case.rb
ruby/sentry-rails/rails-6.0/test/application_system_test_case.rb
require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: :chrome, screen_size: [1400, 1400] end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/test/test_helper.rb
ruby/sentry-rails/rails-6.0/test/test_helper.rb
ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' require 'rails/test_help' class ActiveSupport::TestCase # Run tests in parallel with specified workers parallelize(workers: :number_of_processors) # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all # Add more helper methods to be used by all tests here... end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/test/system/posts_test.rb
ruby/sentry-rails/rails-6.0/test/system/posts_test.rb
require "application_system_test_case" class PostsTest < ApplicationSystemTestCase setup do @post = posts(:one) end test "visiting the index" do visit posts_url assert_selector "h1", text: "Posts" end test "creating a Post" do visit posts_url click_on "New Post" fill_in "Content", with: @post.content fill_in "Title", with: @post.title click_on "Create Post" assert_text "Post was successfully created" click_on "Back" end test "updating a Post" do visit posts_url click_on "Edit", match: :first fill_in "Content", with: @post.content fill_in "Title", with: @post.title click_on "Update Post" assert_text "Post was successfully updated" click_on "Back" end test "destroying a Post" do visit posts_url page.accept_confirm do click_on "Destroy", match: :first end assert_text "Post was successfully destroyed" end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/test/controllers/posts_controller_test.rb
ruby/sentry-rails/rails-6.0/test/controllers/posts_controller_test.rb
require 'test_helper' class PostsControllerTest < ActionDispatch::IntegrationTest setup do @post = posts(:one) end test "should get index" do get posts_url assert_response :success end test "should get new" do get new_post_url assert_response :success end test "should create post" do assert_difference('Post.count') do post posts_url, params: { post: { content: @post.content, title: @post.title } } end assert_redirected_to post_url(Post.last) end test "should show post" do get post_url(@post) assert_response :success end test "should get edit" do get edit_post_url(@post) assert_response :success end test "should update post" do patch post_url(@post), params: { post: { content: @post.content, title: @post.title } } assert_redirected_to post_url(@post) end test "should destroy post" do assert_difference('Post.count', -1) do delete post_url(@post) end assert_redirected_to posts_url end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/test/models/post_test.rb
ruby/sentry-rails/rails-6.0/test/models/post_test.rb
require 'test_helper' class PostTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/test/channels/application_cable/connection_test.rb
ruby/sentry-rails/rails-6.0/test/channels/application_cable/connection_test.rb
require "test_helper" class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase # test "connects with cookies" do # cookies.signed[:user_id] = 42 # # connect # # assert_equal connection.user_id, "42" # end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/application.rb
ruby/sentry-rails/rails-6.0/config/application.rb
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Rails60 class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 6.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. config.consider_all_requests_local = false # https://github.com/getsentry/raven-ruby/issues/494 config.exceptions_app = self.routes config.webpacker.check_yarn_integrity = false config.active_job.queue_adapter = :sidekiq end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/environment.rb
ruby/sentry-rails/rails-6.0/config/environment.rb
# Load the Rails application. require_relative 'application' # Initialize the Rails application. Rails.application.initialize!
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/puma.rb
ruby/sentry-rails/rails-6.0/config/puma.rb
# Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches the default thread size of Active Record. # max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } threads min_threads_count, max_threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. # port ENV.fetch("PORT") { 3000 } # Specifies the `environment` that Puma will run in. # environment ENV.fetch("RAILS_ENV") { "development" } # Specifies the `pidfile` that Puma will use. pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } # Specifies the number of `workers` to boot in clustered mode. # Workers are forked web server processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. # Workers do not work on JRuby or Windows (both of which do not support # processes). # # workers ENV.fetch("WEB_CONCURRENCY") { 2 } # Use the `preload_app!` method when specifying a `workers` number. # This directive tells Puma to first boot the application and load code # before forking the application. This takes advantage of Copy On Write # process behavior so workers use less memory. # # preload_app! # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/routes.rb
ruby/sentry-rails/rails-6.0/config/routes.rb
require "resque/server" Rails.application.routes.draw do resources :posts get '500', to: 'welcome#report_demo' root to: "welcome#index" get 'appearance', to: 'welcome#appearance' get 'connect_trace', to: 'welcome#connect_trace' get 'view_error', to: 'welcome#view_error' get 'sidekiq_error', to: 'welcome#sidekiq_error' get 'resque_error', to: 'welcome#resque_error' get 'delayed_job_error', to: 'welcome#delayed_job_error' get 'job_error', to: 'welcome#job_error' require 'sidekiq/web' mount Sidekiq::Web => '/sidekiq' mount Resque::Server.new, at: "/resque" end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/spring.rb
ruby/sentry-rails/rails-6.0/config/spring.rb
Spring.watch( ".ruby-version", ".rbenv-vars", "tmp/restart.txt", "tmp/caching-dev.txt" )
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/unicorn.rb
ruby/sentry-rails/rails-6.0/config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) timeout 200 preload_app true before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! end after_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' end defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/boot.rb
ruby/sentry-rails/rails-6.0/config/boot.rb
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/content_security_policy.rb
ruby/sentry-rails/rails-6.0/config/initializers/content_security_policy.rb
# Be sure to restart your server when you modify this file. # Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # Rails.application.config.content_security_policy do |policy| # policy.default_src :self, :https # policy.font_src :self, :https, :data # policy.img_src :self, :https, :data # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https # # If you are using webpack-dev-server then specify webpack-dev-server host # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" # end # If you are using UJS then enable automatic nonce generation # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } # Set the nonce only to specific directives # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) # Report CSP violations to a specified URI # For further information see the following documentation: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only # Rails.application.config.content_security_policy_report_only = true
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/filter_parameter_logging.rb
ruby/sentry-rails/rails-6.0/config/initializers/filter_parameter_logging.rb
# Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password]
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/application_controller_renderer.rb
ruby/sentry-rails/rails-6.0/config/initializers/application_controller_renderer.rb
# Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do # ApplicationController.renderer.defaults.merge!( # http_host: 'example.org', # https: false # ) # end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/resque.rb
ruby/sentry-rails/rails-6.0/config/initializers/resque.rb
Resque.logger = Logger.new("#{Rails.root}/log/resque.log") Resque.logger.level = Logger::DEBUG
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/wrap_parameters.rb
ruby/sentry-rails/rails-6.0/config/initializers/wrap_parameters.rb
# Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do # self.include_root_in_json = true # end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/inflections.rb
ruby/sentry-rails/rails-6.0/config/initializers/inflections.rb
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/delayed_job.rb
ruby/sentry-rails/rails-6.0/config/initializers/delayed_job.rb
Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/cookies_serializer.rb
ruby/sentry-rails/rails-6.0/config/initializers/cookies_serializer.rb
# Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/assets.rb
ruby/sentry-rails/rails-6.0/config/initializers/assets.rb
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules folder to the asset load path. Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css )
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/sentry.rb
ruby/sentry-rails/rails-6.0/config/initializers/sentry.rb
Sentry.init do |config| config.breadcrumbs_logger = [:active_support_logger] config.background_worker_threads = 0 config.send_default_pii = true config.traces_sample_rate = 1.0 # set a float between 0.0 and 1.0 to enable performance monitoring config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472' config.release = `git branch --show-current` config.include_local_variables = true # you can use the pre-defined job for the async callback # # config.async = lambda do |event, hint| # Sentry::SendEventJob.perform_later(event, hint) # end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/backtrace_silencers.rb
ruby/sentry-rails/rails-6.0/config/initializers/backtrace_silencers.rb
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers!
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/initializers/mime_types.rb
ruby/sentry-rails/rails-6.0/config/initializers/mime_types.rb
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/environments/test.rb
ruby/sentry-rails/rails-6.0/config/environments/test.rb
# The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. config.cache_classes = false # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/environments/development.rb
ruby/sentry-rails/rails-6.0/config/environments/development.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-6.0/config/environments/production.rb
ruby/sentry-rails/rails-6.0/config/environments/production.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "rails_6_0_production" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false # Inserts middleware to perform automatic connection switching. # The `database_selector` hash is used to pass options to the DatabaseSelector # middleware. The `delay` is used to determine how long to wait after a write # to send a subsequent read to the primary. # # The `database_resolver` class is used by the middleware to determine which # database is appropriate to use based on the time delay. # # The `database_resolver_context` class is used by the middleware to set # timestamps for the last write to the primary. The resolver uses the context # class timestamps to determine how long to wait before reading from the # replica. # # By default Rails will store a last write timestamp in the session. The # DatabaseSelector middleware is designed as such you can define your own # strategy for connection switching and pass that into the middleware through # these configuration options. # config.active_record.database_selector = { delay: 2.seconds } # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/jobs/application_job.rb
ruby/sentry-rails/rails-5.2/app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/helpers/posts_helper.rb
ruby/sentry-rails/rails-5.2/app/helpers/posts_helper.rb
module PostsHelper end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/controllers/posts_controller.rb
ruby/sentry-rails/rails-5.2/app/controllers/posts_controller.rb
class PostsController < ApplicationController before_action :set_post, only: [:show, :edit, :update, :destroy] # GET /posts # GET /posts.json def index @posts = Post.all end # GET /posts/1 # GET /posts/1.json def show end # GET /posts/new def new @post = Post.new end # GET /posts/1/edit def edit end # POST /posts # POST /posts.json def create @post = Post.new(post_params) respond_to do |format| if @post.save format.html { redirect_to @post, notice: 'Post was successfully created.' } format.json { render :show, status: :created, location: @post } else format.html { render :new } format.json { render json: @post.errors, status: :unprocessable_entity } end end end # PATCH/PUT /posts/1 # PATCH/PUT /posts/1.json def update respond_to do |format| if @post.update(post_params) format.html { redirect_to @post, notice: 'Post was successfully updated.' } format.json { render :show, status: :ok, location: @post } else format.html { render :edit } format.json { render json: @post.errors, status: :unprocessable_entity } end end end # DELETE /posts/1 # DELETE /posts/1.json def destroy @post.destroy respond_to do |format| format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_post @post = Post.find(params[:id]) end # Only allow a list of trusted parameters through. def post_params params.require(:post).permit(:title, :content) end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/controllers/welcome_controller.rb
ruby/sentry-rails/rails-5.2/app/controllers/welcome_controller.rb
class WelcomeController < ApplicationController def index 1 / 0 end def report_demo render(status: 500) end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/controllers/application_controller.rb
ruby/sentry-rails/rails-5.2/app/controllers/application_controller.rb
class ApplicationController < ActionController::Base protect_from_forgery with: :exception end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/models/post.rb
ruby/sentry-rails/rails-5.2/app/models/post.rb
class Post < ApplicationRecord end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/models/application_record.rb
ruby/sentry-rails/rails-5.2/app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/channels/application_cable/channel.rb
ruby/sentry-rails/rails-5.2/app/channels/application_cable/channel.rb
module ApplicationCable class Channel < ActionCable::Channel::Base end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/app/channels/application_cable/connection.rb
ruby/sentry-rails/rails-5.2/app/channels/application_cable/connection.rb
module ApplicationCable class Connection < ActionCable::Connection::Base end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/db/seeds.rb
ruby/sentry-rails/rails-5.2/db/seeds.rb
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first)
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/db/schema.rb
ruby/sentry-rails/rails-5.2/db/schema.rb
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2021_01_12_160711) do create_table "posts", force: :cascade do |t| t.string "title" t.text "content" t.datetime "created_at", null: false t.datetime "updated_at", null: false end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/db/migrate/20210112160711_create_posts.rb
ruby/sentry-rails/rails-5.2/db/migrate/20210112160711_create_posts.rb
class CreatePosts < ActiveRecord::Migration[5.2] def change create_table :posts do |t| t.string :title t.text :content t.timestamps end end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/test/system/posts_test.rb
ruby/sentry-rails/rails-5.2/test/system/posts_test.rb
require "application_system_test_case" class PostsTest < ApplicationSystemTestCase setup do @post = posts(:one) end test "visiting the index" do visit posts_url assert_selector "h1", text: "Posts" end test "creating a Post" do visit posts_url click_on "New Post" fill_in "Content", with: @post.content fill_in "Title", with: @post.title click_on "Create Post" assert_text "Post was successfully created" click_on "Back" end test "updating a Post" do visit posts_url click_on "Edit", match: :first fill_in "Content", with: @post.content fill_in "Title", with: @post.title click_on "Update Post" assert_text "Post was successfully updated" click_on "Back" end test "destroying a Post" do visit posts_url page.accept_confirm do click_on "Destroy", match: :first end assert_text "Post was successfully destroyed" end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/test/controllers/posts_controller_test.rb
ruby/sentry-rails/rails-5.2/test/controllers/posts_controller_test.rb
require 'test_helper' class PostsControllerTest < ActionDispatch::IntegrationTest setup do @post = posts(:one) end test "should get index" do get posts_url assert_response :success end test "should get new" do get new_post_url assert_response :success end test "should create post" do assert_difference('Post.count') do post posts_url, params: { post: { content: @post.content, title: @post.title } } end assert_redirected_to post_url(Post.last) end test "should show post" do get post_url(@post) assert_response :success end test "should get edit" do get edit_post_url(@post) assert_response :success end test "should update post" do patch post_url(@post), params: { post: { content: @post.content, title: @post.title } } assert_redirected_to post_url(@post) end test "should destroy post" do assert_difference('Post.count', -1) do delete post_url(@post) end assert_redirected_to posts_url end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/test/models/post_test.rb
ruby/sentry-rails/rails-5.2/test/models/post_test.rb
require 'test_helper' class PostTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/application.rb
ruby/sentry-rails/rails-5.2/config/application.rb
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Rails50 class Application < Rails::Application # https://github.com/getsentry/raven-ruby/issues/494 config.exceptions_app = self.routes # With this enabled 'exceptions_app' isnt executed, so instead we # set ``config.consider_all_requests_local = false`` in development. # config.action_dispatch.show_exceptions = false end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/environment.rb
ruby/sentry-rails/rails-5.2/config/environment.rb
# Load the Rails application. require_relative 'application' # Initialize the Rails application. Rails.application.initialize!
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/puma.rb
ruby/sentry-rails/rails-5.2/config/puma.rb
# Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum, this matches the default thread size of Active Record. # threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests, default is 3000. # port ENV.fetch("PORT") { 3000 } # Specifies the `environment` that Puma will run in. # environment ENV.fetch("RAILS_ENV") { "development" } # Specifies the number of `workers` to boot in clustered mode. # Workers are forked webserver processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. # Workers do not work on JRuby or Windows (both of which do not support # processes). # # workers ENV.fetch("WEB_CONCURRENCY") { 2 } # Use the `preload_app!` method when specifying a `workers` number. # This directive tells Puma to first boot the application and load code # before forking the application. This takes advantage of Copy On Write # process behavior so workers use less memory. If you use this option # you need to make sure to reconnect any threads in the `on_worker_boot` # block. # # preload_app! # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker # process is booted this block will be run, if you are using `preload_app!` # option you will want to use this block to reconnect to any threads # or connections that may have been created at application boot, Ruby # cannot share connections between processes. # # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/routes.rb
ruby/sentry-rails/rails-5.2/config/routes.rb
Rails.application.routes.draw do resources :posts root to: "welcome#index" end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/boot.rb
ruby/sentry-rails/rails-5.2/config/boot.rb
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile.
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/filter_parameter_logging.rb
ruby/sentry-rails/rails-5.2/config/initializers/filter_parameter_logging.rb
# Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password]
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/application_controller_renderer.rb
ruby/sentry-rails/rails-5.2/config/initializers/application_controller_renderer.rb
# Be sure to restart your server when you modify this file. # ApplicationController.renderer.defaults.merge!( # http_host: 'example.org', # https: false # )
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/session_store.rb
ruby/sentry-rails/rails-5.2/config/initializers/session_store.rb
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_rails-5_0_session'
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/new_framework_defaults.rb
ruby/sentry-rails/rails-5.2/config/initializers/new_framework_defaults.rb
# Be sure to restart your server when you modify this file. # # This file contains migration options to ease your Rails 5.0 upgrade. # # Read the Rails 5.0 release notes for more info on each option. # Enable per-form CSRF tokens. Previous versions had false. Rails.application.config.action_controller.per_form_csrf_tokens = true # Enable origin-checking CSRF mitigation. Previous versions had false. Rails.application.config.action_controller.forgery_protection_origin_check = true # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. # Previous versions had false. ActiveSupport.to_time_preserves_timezone = true # Require `belongs_to` associations by default. Previous versions had false. Rails.application.config.active_record.belongs_to_required_by_default = true # Configure SSL options to enable HSTS with subdomains. Previous versions had false. Rails.application.config.ssl_options = { hsts: { subdomains: true } }
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/wrap_parameters.rb
ruby/sentry-rails/rails-5.2/config/initializers/wrap_parameters.rb
# Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do # self.include_root_in_json = true # end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/inflections.rb
ruby/sentry-rails/rails-5.2/config/initializers/inflections.rb
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/cookies_serializer.rb
ruby/sentry-rails/rails-5.2/config/initializers/cookies_serializer.rb
# Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/assets.rb
ruby/sentry-rails/rails-5.2/config/initializers/assets.rb
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js )
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/sentry.rb
ruby/sentry-rails/rails-5.2/config/initializers/sentry.rb
Sentry.init do |config| config.breadcrumbs_logger = [:active_support_logger] config.send_default_pii = true config.traces_sample_rate = 1.0 # set a float between 0.0 and 1.0 to enable performance monitoring config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472' config.release = `git branch --show-current` end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/backtrace_silencers.rb
ruby/sentry-rails/rails-5.2/config/initializers/backtrace_silencers.rb
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers!
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/initializers/mime_types.rb
ruby/sentry-rails/rails-5.2/config/initializers/mime_types.rb
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/environments/test.rb
ruby/sentry-rails/rails-5.2/config/environments/test.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr # Raises error for missing translations # config.action_view.raise_on_missing_translations = true end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/environments/development.rb
ruby/sentry-rails/rails-5.2/config/environments/development.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Enable/disable caching. By default caching is disabled. if Rails.root.join('tmp/caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=172800' } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-5.2/config/environments/production.rb
ruby/sentry-rails/rails-5.2/config/environments/production.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "rails-5_0_#{Rails.env}" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/resque_jobs/raise_error.rb
ruby/sentry-rails/rails-7.0/app/resque_jobs/raise_error.rb
class RaiseError @queue = :default def self.perform 1/0 end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/jobs/application_job.rb
ruby/sentry-rails/rails-7.0/app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked # Most jobs are safe to ignore if the underlying records are no longer available # discard_on ActiveJob::DeserializationError end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/jobs/error_job.rb
ruby/sentry-rails/rails-7.0/app/jobs/error_job.rb
class ErrorJob < ApplicationJob self.queue_adapter = :async def perform a = 1 b = 2 raise "Job failed" end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/workers/error_worker.rb
ruby/sentry-rails/rails-7.0/app/workers/error_worker.rb
class ErrorWorker include Sidekiq::Worker sidekiq_options retry: false def perform a = 1 raise "Worker failed" end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/delayed_jobs/error_delayed_job.rb
ruby/sentry-rails/rails-7.0/app/delayed_jobs/error_delayed_job.rb
class ErrorDelayedJob def self.perform 1/0 end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/helpers/posts_helper.rb
ruby/sentry-rails/rails-7.0/app/helpers/posts_helper.rb
module PostsHelper end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/helpers/application_helper.rb
ruby/sentry-rails/rails-7.0/app/helpers/application_helper.rb
module ApplicationHelper end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/controllers/posts_controller.rb
ruby/sentry-rails/rails-7.0/app/controllers/posts_controller.rb
class PostsController < ApplicationController before_action :set_post, only: [:show, :edit, :update, :destroy] # GET /posts # GET /posts.json def index @posts = Post.all end # GET /posts/1 # GET /posts/1.json def show @post.cover.attach( io: File.open(File.join(Rails.root, 'public', 'favicon.ico')), filename: 'favicon.ico', identify: false ) @post end # GET /posts/new def new @post = Post.new end # GET /posts/1/edit def edit end # POST /posts # POST /posts.json def create @post = Post.new(post_params) respond_to do |format| if @post.save format.html { redirect_to @post, notice: 'Post was successfully created.' } format.json { render :show, status: :created, location: @post } else format.html { render :new } format.json { render json: @post.errors, status: :unprocessable_entity } end end end # PATCH/PUT /posts/1 # PATCH/PUT /posts/1.json def update respond_to do |format| if @post.update(post_params) format.html { redirect_to @post, notice: 'Post was successfully updated.' } format.json { render :show, status: :ok, location: @post } else format.html { render :edit } format.json { render json: @post.errors, status: :unprocessable_entity } end end end # DELETE /posts/1 # DELETE /posts/1.json def destroy @post.destroy respond_to do |format| format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_post @post = Post.find(params[:id]) end # Only allow a list of trusted parameters through. def post_params params.require(:post).permit(:title, :content, :cover) end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/controllers/welcome_controller.rb
ruby/sentry-rails/rails-7.0/app/controllers/welcome_controller.rb
class WelcomeController < ApplicationController before_action :set_sentry_context def index a = 1 b = 0 a / b end def connect_trace # see the sinatra example under the `sentry-ruby` folder response = Net::HTTP.get_response(URI("http://localhost:4567/connect_trace")) render plain: response.code end def appearance end def view_error end def sidekiq_error ErrorWorker.perform_async render plain: "Remember to start sidekiq worker with '$ bundle exec sidekiq'" end def resque_error Resque.enqueue(RaiseError) render plain: "Remember to start resque worker with '$ QUEUE=* bundle exec rake resque:work'" end def delayed_job_error ErrorDelayedJob.delay.perform render plain: "Remember to start delayed_job worker with '$ bundle exec rake jobs:work'" end def job_error ErrorJob.perform_later render plain: "success" end def report_demo # @sentry_event_id = Raven.last_event_id render(status: 500) end private def set_sentry_context counter = (Sentry.get_current_scope.tags[:counter] || 0) + 1 Sentry.set_tags(counter: counter) end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/controllers/application_controller.rb
ruby/sentry-rails/rails-7.0/app/controllers/application_controller.rb
class ApplicationController < ActionController::Base end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/models/post.rb
ruby/sentry-rails/rails-7.0/app/models/post.rb
class Post < ApplicationRecord has_one_attached :cover end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/models/application_record.rb
ruby/sentry-rails/rails-7.0/app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/mailers/application_mailer.rb
ruby/sentry-rails/rails-7.0/app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/channels/appearance_channel.rb
ruby/sentry-rails/rails-7.0/app/channels/appearance_channel.rb
class AppearanceChannel < ApplicationCable::Channel def subscribed end def unsubscribed end def hello end def goodbye(data) 1 / 0 end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/channels/application_cable/channel.rb
ruby/sentry-rails/rails-7.0/app/channels/application_cable/channel.rb
module ApplicationCable class Channel < ActionCable::Channel::Base end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false
getsentry/examples
https://github.com/getsentry/examples/blob/02dbc89a35fe1804dbe00e481716a9dd79920cf5/ruby/sentry-rails/rails-7.0/app/channels/application_cable/connection.rb
ruby/sentry-rails/rails-7.0/app/channels/application_cable/connection.rb
module ApplicationCable class Connection < ActionCable::Connection::Base def connect end end end
ruby
MIT
02dbc89a35fe1804dbe00e481716a9dd79920cf5
2026-01-04T17:57:20.388692Z
false