Ruby on Rails/Âè11²óÊÙ¶¯²ñ - RESTful Rails Development http://www.ark-web.jp/sandbox/wiki/207.html

Ruby on Rails/Âè11²óÊÙ¶¯²ñ - RESTful Rails Development

Ruby on Rails/Âè11²óÊÙ¶¯²ñ - RESTful Rails Development

[edit]

Ruby on RailsÊÙ¶¯²ñ°ìÍ÷

[edit]

Âè11²óÊÙ¶¯²ñ¤Î¥Í¥¿

¥Í¥¿¤â¤È¤Ï²¼µ­¤Ç¤¹¡£

b-simple.de - Ruby on Rails, Entwicklung, Coaching und mehr!
http://www.b-simple.de/documents

[edit]

Æü»þ

[edit]

»²²Ã¼Ô

[edit]

Æ°²è

[edit]

RESTful Rails

[edit]

REST¤È¤Ï¤Ê¤Ë¤«?

[edit]

¤Ê¤¼REST?

[edit]

What's New

¤¢¤Ê¤¿¤Ï°ìÅÙREST¤òÍý²ò¤·¡¢¤½¤Îµ»½Ñ¤òÍøÍѤ¹¤ì¤Ð¡¢RESTful¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÎÀ߷פϼ¡¤Îɸ½à¤È¤Ê¤ë¤À¤í¤¦¡£

[edit]

Preparations

[edit]

Rails 1.2

[edit]

Resource Scaffolding

ruby script/generate scaffold_resource project name:string desc:text
exists app/controllers/
exists app/helpers/
create app/views/projects
exists test/functional/
exists test/unit/
create app/views/projects/index.rhtml
create app/views/projects/show.rhtml
create app/views/projects/new.rhtml
create app/views/projects/edit.rhtml
create app/views/layouts/projects.rhtml
create public/stylesheets/scaffold.
create app/models/project.rb
create app/controllers/projects_controller.
create test/functional/projects_controller_
create app/helpers/projects_helper.
create test/unit/project_test.rb
create test/fixtures/projects.yml
create db/migrate
create db/migrate/001_create_projects.
route map.resources :projects
[edit]

The Model

[edit]

The Controller

[edit]

REST-URLs

[edit]

REST actions are using respond to

[edit]

Accept-Field of the HTTP-Header

[edit]

Format specification via the URL

[edit]

REST-URLs and Views

[edit]

New and Edit

[edit]

Path-Methods in forms: Create and Update

[edit]

The New Form

[edit]

The Edit Form

form_for(:project, :url => project_path(@project),
         :html => { :method => :put }) do |f| ...
=>
<form action="/projects/1" method="post">
<div style="margin:0;padding:0">
<input name="_method" type="hidden" value="put" />
</div>
[edit]

Destroy

link_to "Destroy", project_path(project), :method => :delete
=>
<a href="/projects/1"
onclick="var f = document.createElement(¡Çform¡Ç);
f.style.display = ¡Çnone¡Ç; this.parentNode.appendChild(f);
f.method = ¡ÇPOST¡Ç; f.action = this.href;
var m = document.createElement(¡Çinput¡Ç);
m.setAttribute(¡Çtype¡Ç, ¡Çhidden¡Ç);
m.setAttribute(¡Çname¡Ç, ¡Ç_method¡Ç);
m.setAttribute(¡Çvalue¡Ç, ¡Çdelete¡Ç); f.appendChild(m);f.submit();
return false;">Destroy</a>

Åê¹Æ¼Ô»ÖÅÄ | ¥Ñ¡¼¥Þ¥ê¥ó¥¯

| append.gif

tag: Ruby on Rails, ÊÙ¶¯²ñ


¥È¥Ã¥×   ÊÔ½¸ Åà·ë º¹Ê¬ ¥Ð¥Ã¥¯¥¢¥Ã¥× źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ñ¸ì¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS
Last-modified: 2007-05-30 (¿å) 16:53:10 (6385d)

¥¢¡¼¥¯¥¦¥§¥Ö¤Î¥µ¡¼¥Ó¥¹¤ä¥½¥ê¥å¡¼¥·¥ç¥ó¤Ï¤³¤Á¤é