Start manually:
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Stop manually:
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast
$ curl -u 'USER:PASS' https://api.github.com/user/repos -d '{"name":"REPO"}'
$ git remote add origin [email protected]:USER/REPO.git
$ git push origin master
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
YAML::ENGINE.yamler = 'syck' |
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
### find things in your table | |
Model.find_by_<key>(value) # Limits 1 | |
Model.where(:key => value) # No limit, returns all | |
example = Model.find_by_<key>(key) | |
example.key = 'value' # this will return the key/value and update it | |
### find/create by | |
Model.find_or_create_by_<key>(key) |
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
# Some cool stuff | |
begin | |
# code | |
rescue #error message | |
# code to what next | |
retry # if you want to run begin again | |
end |
### create new column in database model
$ rails generate migration add_column_to_<modelname> <column>:<class>
$ rake db:migrate
### drop a table from the database
$ rails c
$ ActiveRecord::Base.connection.drop_table :your_table_name
### using heroku
$ rails new <name> -T -d postgresql
# makes new project with no tests and postgresql database
$ psql -U postgres
### CREATION w/o Password
$ createuser
# fill shit in
$ createdb <databasename>
$ psql -U postgres
$ alter user <username>;
# ALTER USER
NewerOlder