This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax = docker/dockerfile:1 | |
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | |
ARG RUBY_VERSION=3.2.1 | |
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base | |
# Rails app lives here | |
WORKDIR /rails | |
# Set production environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example | |
def initialize(employee_id) | |
@employee_id = employee_id | |
end | |
def call | |
ExampleJob.perform_async(@employee_id) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'rails_helper' | |
require 'benchmark' | |
describe Users::Roles::Create do | |
subject(:service) { described_class.new(user, role_params).call } | |
let(:user) { create(:user) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def authenticate(*credentials, &block) | |
raise ArgumentError, 'at least 2 arguments required' if credentials.size < 2 | |
if credentials[0].blank? | |
return authentication_response(return_value: false, failure: :invalid_login, &block) | |
end | |
if @sorcery_config.downcase_username_before_authenticating | |
credentials[0].downcase! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'pry' | |
gem "sqlite3" | |
gem 'activerecord' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Booking < ApplicationRecord | |
belongs_to :room, primary_key: :room_id, foreign_key: :room_id | |
belongs_to :guest, primary_key: :guest_id, foreign_key: :guest_id | |
end | |
class Guest < ApplicationRecord | |
has_many :bookings, primary_key: :booking_id, foreign_key: :booking_id | |
end | |
class Room < ApplicationRecord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'json', require: false | |
gem 'httparty' | |
gem 'pry' | |
end |