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 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 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 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 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 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"s3:ListBucket" | |
], | |
"Resource": [ | |
"arn:aws:s3:::bucket-name" |
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
#!/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
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
#!/usr/bin/env bash | |
docker run \ | |
-d \ | |
--name "mysql" \ | |
--restart unless-stopped \ | |
-p 3306:3306 \ | |
--mount 'type=volume,source=mysql_storage,target=/var/lib/mysql,volume-driver=local' \ | |
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ | |
mysql:5.7 |
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
#!/usr/bin/env bash | |
docker run \ | |
-d \ | |
--name "postgresql" \ | |
--restart unless-stopped \ | |
-p 5432:5432 \ | |
--mount 'type=volume,source=postgresql_storage,target=/var/lib/postgresql/data,volume-driver=local' \ | |
-e POSTGRES_USER=postgres \ | |
-e POSTGRES_DB=postgres \ |