Skip to content

Instantly share code, notes, and snippets.

@abnersajr
Last active July 23, 2018 20:42
Show Gist options
  • Save abnersajr/ca206df77cea82d6bc1e9ff97d93fc36 to your computer and use it in GitHub Desktop.
Save abnersajr/ca206df77cea82d6bc1e9ff97d93fc36 to your computer and use it in GitHub Desktop.
Learning Rails

Learning Rails

references

https://medium.com/@PaulWritesCode/ruby-on-rails-with-visual-studio-code-bc5681a2c098\

Heroku

  • heroku keys:add: useful command to add SSH Keys to heroku

ASDF

Using ASDF to manage postgres you have this commands some commands:

  • createdb <name_db>
  • dropdb <name_db>
  • pg_ctl <commando>

Vscode Tasks:

In the root of project's folder you create a .vscode folder with tasks.json and copy the code down below:

{
   "version":"2.0.0",
   "tasks":[
      {
         "taskName":"beautify",
         "type":"shell",
         "command":"htmlbeautifier ${relativeFile}",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"never"
         }
      },
      {
         "taskName":"rubocop",
         "type":"shell",
         "command":"rubocop --auto-correct ${relativeFile}",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"never"
         }
      },
      {
         "taskName":"rspec",
         "type":"shell",
         "command":"bundle exec rspec",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"always"
         }
      },
      {
         "taskName":"rspec file",
         "type":"shell",
         "command":"bundle exec rspec ${relativeFile}",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"always"
         }
      },
      {
         "taskName":"rails c",
         "type":"shell",
         "command":"bundle exec rails console",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"always"
         }
      },
      {
         "taskName":"rails s",
         "type":"shell",
         "command":"bundle exec rails server",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"always"
         }
      },
      {
         "taskName":"cap production deploy",
         "type":"shell",
         "command":"cap production deploy",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"always"
         }
      },
      {
         "taskName":"configure",
         "type":"shell",
         "command":"gem install ruby-debug-ide:0.6.0 debase:0.2.2.beta10 rcodetools rubocop fastri htmlbeautifier --no-ri --no-rdoc",
         "problemMatcher":[

         ],
         "presentation":{
            "reveal":"always"
         }
      }
   ]
}

RAILS

Naming Conventions

  • Model Name -> Singular, First letter Uppercase
  • Table Name -> Plural, lower case of model name
  • Model file name -> All lowercase but singular, article.rb
  • Controller name -> plural of model so articles_controller.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment