watch list - day1

1333 단어 rubyrailsrails

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

좋은 웹페이지 즐겨찾기