getting started with rails (4)
TRANSCRIPT
Getting����������� ������������������ Started����������� ������������������ (4)
2014. 12. 9 Lucius Choi(@luciuschoi)
ROR Lab. Season 4, 76th Biweekly Lecture
MVCrequest(URI)
routing
response
controller action
Cmodel
M
viewV
database
“Article”����������� ������������������ Model
articles
title string text text
has_many :comments, dependent: :destroy
“Comment”����������� ������������������ Model
comments
commenter string body text article_id integer
belongs_to :article
Nested����������� ������������������ Routing$ rake routes Prefix Verb URI Pattern Controller#Action article_comments GET /articles/:article_id/comments(.:format) comments#index POST /articles/:article_id/comments(.:format) comments#create new_article_comment GET /articles/:article_id/comments/new(.:format) comments#newedit_article_comment GET /articles/:article_id/comments/:id/edit(.:format) comments#edit article_comment GET /articles/:article_id/comments/:id(.:format) comments#show PATCH /articles/:article_id/comments/:id(.:format) comments#update PUT /articles/:article_id/comments/:id(.:format) comments#update DELETE /articles/:article_id/comments/:id(.:format) comments#destroy 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#index welcome_index GET /welcome/index(.:format) welcome#index
Partial����������� ������������������ Template
• _template_name.html.erb
• using instance variables in parent template file
• “form” partial template : _form.html.erb
HTTP����������� ������������������ Basic����������� ������������������ Auth.
• http_basic_authenticate_with( name, password)
Live����������� ������������������ Demo
����������� ������������������ 감사합니다.