En estos ejemplos la Tabla A tiene un has_many
y la Tabla B un belongs_to
y no tienen en cuenta que en la Tabla B podría haber varias referencias al mismo registro de la Tabla A, lo que produce duplicados de los registros de la Tabla A al hacer los joins.
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
# Use with Ubuntu 22.04 jammy | |
# Prepare system | |
sudo apt update | |
sudo apt upgrade -y | |
# install docker |
$ bundle config build.pg --with-opt-dir="/usr/local/opt/libpq"
$ gem install mysql2 -- --with-mysql-dir=/opt/homebrew/opt/mysql-client
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 ApplicationController < ActionController::Base | |
private | |
attr_reader :execution | |
def execute(action, params={}) | |
@execution = action.new(params.reverse_merge(default_execute_params).call | |
end | |
def default_execute_params |
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 ActionBase | |
def self.call(*params) | |
new(*params).call | |
end | |
def self.on(event, *methods) | |
methods.each { |m| __on_listeners[event.to_sym] << m.to_sym } | |
end | |
def self.__on_listeners |
$ sudo apt-get update
$ sudo apt-get install ca-certificates curl gnupg lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"s3:ListBucket" | |
], | |
"Resource": [ | |
"arn:aws:s3:::bucket-name" |
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
#!/usr/bin/env bash | |
docker run \ | |
-d \ | |
--name "redis" \ | |
--restart unless-stopped \ | |
-p 6379:6379 \ | |
--mount 'type=volume,source=redis_storage,target=/data,volume-driver=local' \ | |
redis |
- Abrimos Arduino > Preferences
- Añadimos "http://arduino.esp8266.com/stable/package_esp8266com_index.json" al cuadro de texto