Show Menu
Cheatography

Personal Cheat Sheet by

Rails

rails server [-b $IP -p $PORT]
start server
rails generate scaffold table colum­ntype ...
rails [vers­ion] new name
create new rails app
bundle install
install gems in Gemfile. updates Gemfil­e.lock
bundle exec command
run command with gems from Gemfil­e.lock
bundle update
update list of gems
rails console
opens up access to models
----- Rails Shortcuts ----
rails server
rails s
rails console
rails c
rails generate
rails g
bundle install
bundle
rake test
rake
rails generate controller action ...
bundle - gem install bundler view

Git

git push --set-­ups­tream remote branch
link current branch to remote branch
git push -u origin branch
create and link branch remotely
git config [--global] user.name name
git config [--global] user.email email
git clone <re­po> [<d­ir>]
clone <re­po> with <di­r> name
git revert <co­mmi­t>
git diff master...<­br­anc­h>
difference between <br­anc­h> and where <br­anc­h> diverged from master

gem

gem list gem

Ruby Version Manager (RVM)

rvm use X
X = version you want to use, such as 2.1.4

Minitest

ruby path/t­o/f­ile.rb --name test_m­eth­od_name
Run one specific test

Heroku

heroku version
heroku login
heroku keys:add
heroku create [name]
heroku open
opens running app in browser
heroku rename name
heroku logs
git push heroku master
rebuil­d/rerun app with latest code?

Rake

rake -T [name­space]
display all tasks [in namespace]

Rubocop

rubocop --auto­-ge­n-c­onfig
rubocop -a
auto cleanup

Active Record

Conten­tDe­fin­iti­on.w­he­re(­'di­spl­ay_name NOT LIKE (?)', ['test%'])
Colle­cti­on.de­let­e_all

Work

lsof -wni tcp:9292
NS
lsof -wni tcp:7999
AUTH
lsof -wni tcp:8081
RLS
kill -9 PID
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by Wayland He

          Rails4 Model&Migration Generator (WorkInProgress) Cheat Sheet