getting started with rails (3)

9
Getting Started (3) 2014. 11. 25 Lucius Choi(@luciuschoi) ROR Lab. Season 4, 75th Biweekly Lecture

Upload: ror-lab

Post on 13-Jul-2015

66 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Getting Started with Rails (3)

Getting����������� ������������������  Started����������� ������������������  (3)

2014. 11. 25 Lucius Choi(@luciuschoi)

ROR Lab. Season 4, 75th Biweekly Lecture

Page 2: Getting Started with Rails (3)

MVCrequest(URI)

routing

response

controller action

Cmodel

M

viewV

database

Page 3: Getting Started with Rails (3)

“Article”����������� ������������������  Model

articles

title string text text

Page 4: Getting Started with Rails (3)

“Comment”����������� ������������������  Model

comments

commenter string body text article_id integer

Page 5: Getting Started with Rails (3)

Resource����������� ������������������  Routing

$ rake routes Prefix Verb URI Pattern Controller#Action articles GET /articles(.:format) articles#index POST /articles(.:format) articles#create new_article GET /articles/new(.:format) articles#new edit_article GET /articles/:id/edit(.:format) articles#edit article GET /articles/:id(.:format) articles#show PATCH /articles/:id(.:format) articles#update PUT /articles/:id(.:format) articles#update DELETE /articles/:id(.:format) articles#destroy root GET / welcome#indexwelcome_index GET /welcome/index(.:format) welcome#index

Page 6: Getting Started with Rails (3)

Method����������� ������������������  vs����������� ������������������  Action

• public methods => “actions”

• action => render a view template or redirect

Page 7: Getting Started with Rails (3)

HTTP����������� ������������������  Basic����������� ������������������  Auth.

• http_basic_authenticate_with( name, password)

Page 8: Getting Started with Rails (3)

Live����������� ������������������  Demo

Page 9: Getting Started with Rails (3)

����������� ������������������  감사합니다.