SpringFlowers AutumnMoon
2009-May-24 14:04 UTC
why does form_for @story has to have Story as RESTful
it seems that when we use form_for @story do |f| then Story has to be a RESTful resource and it has to be map.resources :stories in the routes.rb? can Story be not RESTful? Can it be a form for non-RESTful data? -- Posted via http://www.ruby-forum.com/.
Denis Haskin
2009-May-24 14:45 UTC
Re: why does form_for @story has to have Story as RESTful
"can Story be not RESTful? Can it be a form for non-RESTful data?"
Sure. Keep in mind one of the Rails tenets: "convention over
configuration".
Take a look at the HTML generated by form_for in the various REST
contexts (e.g. new, edit). *By default* it Does The Right Thing if
you''re using RESTful resources.
But there''s nothing to stop you from overriding the configuration,
e.g.:
form_for @order, :url => checkout_details_path, :method => :put do |f|
and having a route to support it.
dwh
SpringFlowers AutumnMoon wrote:> it seems that when we use
>
> form_for @story do |f|
>
> then Story has to be a RESTful resource and it has to be
>
> map.resources :stories
>
> in the routes.rb?
>
> can Story be not RESTful? Can it be a form for non-RESTful data?
>