Skip to content

Instantly share code, notes, and snippets.

View LeonidFilbert's full-sized avatar

Leonid Skrypnikov LeonidFilbert

View GitHub Profile
@LeonidFilbert
LeonidFilbert / application_command.rb
Created November 22, 2024 13:34
EXAMPLE: Command pattern -> Loyaltie
# frozen_string_literal: true
#app/commands/application_command.rb
class ApplicationCommand
include ActiveModel::Model
include ActiveModel::Validations
SENSITIVE_FIELDS = %i[password token credit_card_number].freeze
ERROR_ATTRIBUTES = %i[command oauth_service].freeze
def self.call(*args)

#naming conventions #

General conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@LeonidFilbert
LeonidFilbert / table_list.rb
Created February 9, 2018 15:48 — forked from harssh/table_list.rb
List all tables in rails app using console
# This command will list all table in a rails app in rails console
ActiveRecord::Base.connection.tables