- Model -> singular, eg: 'car' , 'child'
- table -> plural, eg: 'cars', 'children'
Which columns/attributes should we add to our table? After give it a thought
rails g model :ModelName : : ...
It's not a rule, it's a convention. What is important is that you show employers you know how to write a meaningful commit message so you have a structured commit history.
❌ git commit -m "finally fixed that bug yooo!"
feat
, fix
, refactor
etc., followed by a colon and a space.feat
MUST be used when a commit adds a new feature to your application.fix
MUST be used when a commit represents a bug fix for your application.✅ git commit -m "feat: add restaurant grid to index"
puts '*' * 50 | |
puts ' ' * 4 + '🎄 Welcome to your Christmas gift list 🎄' | |
puts '*' * 50 | |
gift_list = [ | |
{ name: 'Flamengo T-Shirt', status: false }, | |
{ name: 'Christmas Socks', status: true } |
# User starts with 100 euros | |
# user looses 10 when loosing | |
# user wins 50 when winning | |
# User can play until they are BROKE | |
# 1. create a wallet for the user (store the user balance) | |
wallet = 20 | |
# 2. Make it a loop | |
# 3. Increase/Decrease the money into the wallet (update user balance) |
# METHOD | |
# piece of code that we want to be able to reuse | |
# 1. name | |
# 2. it has parameters or not => THE ORDER matter!!! | |
# 3. returns something | |
def calculator(first_number, second_number, operator) | |
# if operator == '+' | |
# result = first_number + second_number | |
# elsif operator == '-' |
Something extremely important for you to know when preparing your trello cards and actually coding your features:
Think about FEATURES (example: search functionality, build CSS componentes) OR USER STORIES (create a new restaurant, save a post as your favourite), NEVER about the MVC layers
Implement the New and Create for Restaurants/Cars/Invoices/etc. (this includes routes + controller + new and create actions + strong params + new.html.erb + form + TESTING THE FEATURE!!!!)
Implement the definitive CSS for Forms (this includes building the CSS classes, adding them to the existing forms of the application, showing to your teammates how to do the same for future forms)
# TODO: you can build your christmas list program here! | |
# Pseudo-code: | |
# Define gift list as an ARRAY | |
gift_list = [{ 'name' => 'Laptop', 'status' => true }, { 'name' => 'Car', 'status' => false }] | |
# 1. Welcome | |
puts "Welcome to your Christmas gift list" | |
action = 'start' # initialize variable |
# Use the MAP iterator to convert the variable hogwarts, array of arrays, into an array of hashes. | |
# Those hashes should have two keys: :name and :house | |
hogwarts = [['hermione', 'griffyndor'], ['draco', 'slytherin'], ['luna', 'ravenclaw'], ['cedric', 'hufflepuff']] | |
# PSEUDO CODE | |
p hogwarts | |
# 1. go over the hogwarts array (MAP) | |
hogwarts = hogwarts.map do |inner_array| | |
# p inner_array[0] |