$ rails console -e test --sandbox
require 'factory_bot'; include FactoryBot::Syntax::Methods
[nil, | |
"Pending", | |
"Pending", | |
"Pending", | |
"Accepted", | |
"Accepted", | |
"Accepted", | |
"Accepted", | |
"Accepted", | |
"Accepted", |
{ | |
"EntityId":"0688705d-ea53-4010-8cb6-570fcb44e0d4", | |
"OrganisationId":"dce2c439-040b-448c-879c-045d99da9193", | |
"BranchId":"4aa26861-251d-46bc-9261-194d7a343e94", | |
"ExternalDonorBranchId":"TESCO:6316", | |
"DonationId":"67fe8dca-de31-4500-9729-1857f450888c", | |
"ExternalDonationId":"d565d704-2d3b-4297-992e-68b7577c779f", | |
"DonationCreatedAt":"2023-08-07T18:29:37.000000Z", | |
"Metadata":null, | |
"MessageType":"OfferPending", |
{ | |
"EntityId":"0688705d-ea53-4010-8cb6-570fcb44e0d4", | |
"OrganisationId":"dce2c439-040b-448c-879c-045d99da9193", | |
"BranchId":"4aa26861-251d-46bc-9261-194d7a343e94", | |
"ExternalDonorBranchId":"TESCO:6316", | |
"DonationId":"67fe8dca-de31-4500-9729-1857f450888c", | |
"ExternalDonationId":"d565d704-2d3b-4297-992e-68b7577c779f", | |
"DonationCreatedAt":"2023-08-07T18:29:37.000000Z", | |
"Metadata":null, | |
"MessageType":"OfferPending", |
# Bad | |
class MyClass | |
COSNT_NAME = "boz" | |
attr_reader :foo, :bar, :baz | |
def initialize(foo, bar, baz) | |
@foo = foo | |
@bar = bar | |
@baz = baz | |
end |
require 'nokogiri' | |
require 'uri' | |
require 'net/http' | |
require 'byebug' | |
require 'json' | |
# Block example | |
def requester(url, &block) | |
uri = URI(url) | |
res = Net::HTTP.get_response(uri) |
require 'benchmark' | |
require 'dry-struct' | |
require 'ostruct' | |
require 'hashie' | |
require 'active_support' | |
class ClassCar | |
attr_accessor :wheels, :mileage | |
end |
$ rails console -e test --sandbox
require 'factory_bot'; include FactoryBot::Syntax::Methods
def my_method | |
# ... | |
rescue NoMethodError => e | |
Sentry.with_scope do |scope| | |
scope.set_tags(foo: "bar") # <= Searchable tags | |
scope.set_context('Model Attributes', @local_instance_variable.attributes) # <= Logs extra hash of data | |
Sentry.capture_message("A test message") # <= Your custom message | |
Sentry.capture_error(e) # <= Log the error | |
end | |
end |
Installing the ruby PG gem requires Postgres to be instaled locally to install the gem, which is annoying and unnecessary if you're building inside of docker.
An error occurred while installing pg (1.2.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.2.3' --source 'https://rubygems.org/'` succeeds before bundling.