【发布时间】:2015-12-03 19:33:17
【问题描述】:
我使用 --api 参数创建新的 Rails 应用程序,如手动 http://edgeguides.rubyonrails.org/api_app.html
rails new app2 --api
我使用的脚手架
bin/rails generate scaffold People first_name:string last_name:string age:integer
Rails 生成的控制器不仅包含 json 结果的操作,而且不需要“新建”和“编辑”操作,以及 html 渲染
它还会生成
create app/views/people
create app/views/people/index.html.erb
create app/views/people/edit.html.erb
create app/views/people/show.html.erb
create app/views/people/new.html.erb
create app/views/people/_form.html.erb
我不需要,因为我只需要 API
为什么?
我想收到结果,就像我使用 rails-api gem
Rails 的版本是 4.2.5
【问题讨论】:
标签: ruby-on-rails api rest