rails watch list - day1

Minsoo·2022년 3월 23일
0

rails

목록 보기
3/4

1. rails new setup

2. scratching DB

3. rails g model

  • datatypes

    url:string
    foriegn_keys:references

  • association

    dependent: :destroy
    Destroying the children is ideal. You do that by setting dependent: :destroy on the has_many relationship. Like so:

    class Parent ApplicationRecord
        has_many :children, dependent: :destroy
     end

https://blog.getcensus.com/cascading-deletes-in-rails/

  • validation (has_many, belongs_to)

    bookmark.rb (bookmark model)

    validates_uniqueness_of :movie_id, scope: :list_id

4. routes.rb setup

5. rails g controller

  • devise authentication setup (tbc)
  • make method following the routes
  • make private method in order to get secured params.e
  • make private method find model
profile
Hello all 👋🏻 📍London

0개의 댓글