I did:
resources :posts
What's the difference between the 'create' and the 'new' urls?开发者_运维百科
In the Rails convention new
is used with the HTTP verb GET
and create
is used with POST
.
Say you are creating a blog and you have a model object called post
. In the controller the new
method will send a new post object to the view (a form). When the user fills out the form in the view and clicks submit, the form will POST
the data to the controller's create
method where it will be saved.
精彩评论