Github cheatsheet-ac
git log : View commit history
git log --stat : View commit history with more details
| require 'benchmark' | |
| num1 = 42 | |
| num2 = 43 | |
| immediate_time = Benchmark.realtime do | |
| 9_000_000.times do | |
| num1 + num2 | |
| end | |
| end |
Github cheatsheet-ac
git log : View commit history
git log --stat : View commit history with more details
Gem commands cheatsheet.md
gem list - List all gems installed
gem list -i <gem_name> - It shows if a gem exists or not. The output is true or false
gem list <gem_name> - It shows the gem version
Example: gem list zlib
gem which - It shows the gem path
PostgreSQL command line cheatsheet-ac.md
sudo -u postgres psql : Enter the console
\password postgres : E
\du : List all users
\l : List of databases
\q : Disconnect
Lookup Active Record Query Interface http://guides.rubyonrails.org/active_record_querying.html
ActiveRecord::QueryMethods http://api.rubyonrails.org
Class methods http://api.rubyonrails.org/classes/ActiveRecord/Scoping/Named/ClassMethods.html
Visit my website: www.alexandrecalaca.com.br
In our example, there are2 models: Blog and Topic. Think about a single topic blog.
So, A blog can belong to only one topic. A topic has many different blogs.
Blog (N) X (1) topic The foreign key needs to be in the blog model.
Check my website: www.alexandrecalaca.com.br
rails generate migration add_post_status_to_blogs status:integerdef change
add_column :blogs, :status, :integer, default: 0Check my website: www.alexandrecalaca.com.br
Now, it's time to rock. Go to rails console.
rails consoleCreate one blog and see the slug created
My profile: https://about.me/alexandrecalaca
1. Update your system
sudo apt-get update
2. Install build-essential
sudo apt-get install -y build-essential
My profile: https://about.me/alexandrecalaca
1. Check you RVM version
rvm versionYou`re going to a message like this: rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]
2. Uninstall RVM gem