js-rails-as-api-rendering-different-content-types-using-rails-v-000

时间:2021-03-09 02:46:18
【文件属性】:
文件名称:js-rails-as-api-rendering-different-content-types-using-rails-v-000
文件大小:55KB
文件格式:ZIP
更新时间:2021-03-09 02:46:18
Ruby 在Rails中渲染不同的内容类型 学习目标 覆盖默认的Rails视图 从Rails控制器渲染纯文本 从Rails控制器渲染JSON 介绍 在上一课中,我们重新讨论了默认的Rails MVC结构,最后,呈现了一个ERB文件。 但是,Rails可以呈现多种类型的内容。 在本课程中,我们将研究在构建Rails API时最有用的一些内容类型。 接下来,请运行rails db:migrate和rails db:seed来设置数据库和示例数据。 覆盖默认的Rails视图 与上一课的解决方案不同, index操作使所有鸟类都处于: class BirdsController < ApplicationController def index @birds = Bird . all   end end 我们知道这与显式声明相同: class BirdsController < Appl
【文件预览】:
js-rails-as-api-rendering-different-content-types-using-rails-v-000-master
----.gitignore(215B)
----app()
--------mailers()
--------assets()
--------models()
--------helpers()
--------views()
--------jobs()
--------channels()
--------controllers()
----config.ru(130B)
----package.json(70B)
----LICENSE.md(1KB)
----bin()
--------rails(264B)
--------setup(957B)
--------bundle(125B)
--------spring(507B)
--------update(819B)
--------yarn(303B)
--------rake(213B)
----storage()
--------.keep(0B)
----log()
--------.keep(0B)
----CONTRIBUTING.md(2KB)
----db()
--------migrate()
--------seeds.rb(637B)
--------schema.rb(953B)
----.ruby-version(10B)
----public()
--------robots.txt(98B)
--------apple-touch-icon.png(0B)
--------422.html(2KB)
--------apple-touch-icon-precomposed.png(0B)
--------favicon.ico(0B)
--------500.html(2KB)
--------404.html(2KB)
----example_frontend.html(383B)
----README.md(9KB)
----vendor()
--------.keep(0B)
----config()
--------cable.yml(194B)
--------spring.rb(111B)
--------credentials.yml.enc(464B)
--------boot.rb(207B)
--------database.yml(594B)
--------routes.rb(68B)
--------environments()
--------environment.rb(128B)
--------application.rb(832B)
--------storage.yml(1KB)
--------locales()
--------puma.rb(1KB)
--------initializers()
--------master.key(32B)
----lib()
--------assets()
--------tasks()
----Gemfile(2KB)
----.learn(50B)
----Rakefile(227B)
----Gemfile.lock(5KB)

网友评论