- Description of the project here
- Rack: a Ruby Webserver Interface`
- ++;
# Use git bash or other command interpreter on the project directory
vagrant up # instanciate the machine
vagrant ssh # ssh into the machine
cd /vagrant
rails s # http://localhost:3000/
before action #To controll routes via permissions(admin,etc)
# Ver rotas em: xxxx/router.rb
rails routes # Mostrar rotas para controladorses
api namespace #gerar automaticamente a versão de uma api,por exemplo, no ficheiro de rotas
rails g scaffold_controller <name> # generate controller for a certain model
sudo -su postgres
psql -d vagrant_development -c "SELECT * FROM users;"
OR
sudo -su postgres
psql
\l #list all of the tables, views, and sequences in the database
\connect database_name
SELECT * FROM table_name;
\q #Exit
bundle exec erd #It will save a pdf file on root directory
Advise: Use Postman or... use the stone age way as described:(can be util for frontend request using axios or fetch)
1. http://localhost:3000/api/v1/register/
body example(json format):
{
"email": "example@ipt.pt",
"password" : "example"
}
2. Sended email confirmation
3. http://localhost:3000/api/v1/login/ # Obatin JWT (this was divided for security reasons)
body example(json format):
{
"email": "example@ipt.pt",
"password" : "example"
}
1. http://localhost:3000/api/v1/forgot/
2. Sended email to reset password
3. http://localhost:3000/api/v1/reset/
body example(json format):
{
"password" : "newexample"
}
http://localhost:3000/api/v1/participants/
body example(json format):
{
"Authorization" : "Bearer <tokenhere>"
}
- You need the master.key - Create this file on config folder and paste the key provided by some guy/girl
- config.require_master_key = true - on every enviroment do you wanna use it(It is already done)
- Sleep because if you though this new version of rails would use the same approach as lowers versions, you must be overclocked!
- A pc
EDITOR=vim rails credentials:edit #EDIT - you can change your type of editor(i.e. sublime)
# Example: foo: bar
Rails.application.credentials.foo #ACESS - will return bar
https://www.engineyard.com/blog/rails-encrypted-credentials-on-rails-5.2
Password will be: vagrant https://laracasts.com/discuss/channels/general-discussion/fortgot-vagrant-password?page=1
To add:
- Services (job queues, cache servers, search engines, etc.)
git show-branch -a git checkout
Forget to create branch and have already commited files?(Use stash on addition!!!!) https://stackoverflow.com/questions/9529078/how-do-i-use-git-reset-hard-head-to-revert-to-a-previous-commit
git pull origin development