Why does form_for @story has to have Story as RESTful


#1

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?


#2

“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