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
| # Shoulda activemodel cheatsheet | |
| # DB | |
| should have_db_column(:title).of_type(:string).with_options(default: 'Untitled', null: false) | |
| should have_db_index(:email).unique(:true) | |
| # Associations | |
| should belong_to :company | |
| should have_one(:profile).dependent(:destroy) | |
| should have_many(:posts).dependent(:nullify) |
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 sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
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
| DELIMITER $$ | |
| DROP TRIGGER IF EXISTS hotel_au_trg$$ | |
| CREATE TRIGGER hotel_au_trg AFTER UPDATE ON hotels | |
| FOR EACH ROW | |
| BEGIN | |
| IF (OLD.name != NEW.name OR (OLD.name IS NULL AND NEW.name IS NOT NULL)) THEN | |
| REPLACE INTO audits values ('',NEW.id,'name',NOW(),NULL,NULL); | |
| END IF; | |
| IF (OLD.latitude != NEW.latitude OR (OLD.latitude IS NULL AND NEW.latitude IS NOT NULL)) THEN | |
| REPLACE INTO audits values ('',NEW.id,'latitude',NOW(),NULL,NULL); |
NewerOlder