Skip to content

Instantly share code, notes, and snippets.

@boratanrikulu
Last active July 29, 2019 15:36
Show Gist options
  • Save boratanrikulu/503ec9b48d2e15f1a04813b8cb1a4089 to your computer and use it in GitHub Desktop.
Save boratanrikulu/503ec9b48d2e15f1a04813b8cb1a4089 to your computer and use it in GitHub Desktop.
MVC Nasıl Çalışır

MVC [Model, View, Controller]


             GET articles   --------
             ------------> | SERVER | >--------------------------------
            /               ---------                                  |
           /               my_wee_blog                                 |
          /                                                            |
 --------/                                                             |
| Client |                  - Article                                  |
 --------                        - Article(model)                      |
                                 - articles(controller)                |
  get '/articles', <------------ - articles(resources)                 |
       to: 'articlles#index'     - articles(view)                      |
                                    - new                              |
                                    - edit                             |
                                                                       |
                                                                       |
  |--------------------------------------------------------------------|
  |
  v
  GET articles -> articles#index -> Article.all -> index.html.erb
  \
   \
    \
     \
      \
       --------
      | ROUTES |
       --------
                \                   (instance variable)
                 \                       @articles          ------                    erb yorumlanır
                  \                 ---------------------> | View | (index.html.erb) ----------------> index.html
                   \               /                        ------
                    \             /
                     ------------ 
                    | Controller |
                     ------------ 
       @articles = Article.all   \\             ----
        Article.all ile model ile \\           | DB |
        iletişim kurularak DB'den  \\           ----
        tüm article'ler çekilir     \\          /
        ve bir değişkene atılır      \\        /
                                       --------
                                      | Model  |
                                       --------
@hasantezcan
Copy link

hasantezcan commented Jul 29, 2019

Are you crazy? 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment