This file contains hidden or 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 User < ApplicationRecord | |
| has_many :posts | |
| # Violates Single Responsibility Principle (SRP) | |
| def make_admin | |
| self.update(:is_admin, true) | |
| end | |
| # Violates Law of Demeter (LoD) and N+1 query issue | |
| def recent_posts_with_comments |
This file contains hidden or 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 Agents < ActiveRecord::Base | |
| has_many :operations | |
| attr_accessor :all_operations_are_success | |
| def operators | |
| self.operations.map { |o| o.operator } | |
| end | |
This file contains hidden or 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
| if empty(glob('~/.vim/autoload/plug.vim')) | |
| silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
| \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
| autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
| endif | |
| call plug#begin('~/.vim/plugged') | |
| Plug 'jlanzarotta/bufexplorer' | |
| Plug 'junegunn/fzf.vim' | |
| Plug 'scrooloose/nerdcommenter' |