ruby script/generate scaffold post title:string doc:text ruby script/generate scaffold comment post:references doc:text Map.resources :posts :has_many=>:comments
gem install nested_restful_scaffold
script/generate nested_restful_scaffold ModelName [field:type, field:type, resource1,resource2,...:resources]
eg:
script/generate nested_restful_scaffold book name:string description:text library:references library:resources
map.resources :libraries do |library| library.resources :books end
嵌套资源的URL前加api的方法是
map.with_options(:path_prefix => "/api") do |api| api.resources :circles do |circle| circle.resources :activities end end