显示关联rails-dumbo-web-111819

时间:2021-02-13 14:38:03
【文件属性】:
文件名称:显示关联rails-dumbo-web-111819
文件大小:59KB
文件格式:ZIP
更新时间:2021-02-13 14:38:03
Ruby 显示关联Rails 目标 学完本课后,您应该能够... 创建has_many和belongs_to关联。 通过控制台和db/seeds.rb构建关联的数据。 使用关联提供的方法查询关联数据。 将关联数据嵌入视图中。 遍历显示单个实例的视图内的关联数据。 博客类别 在本课程中,我们将设置一个博客管理面板,以便可以创建Post对象,将其与Category对象相关联,并按Category列出。 模型 首先,就像上一课一样,我们将建立关联的模型: # app/models/post.rb class Post < ActiveRecord :: Base belongs_to :category end # app/models/category.rb class Category < ActiveRecord :: Base has_many :posts end 种子数据
【文件预览】:
displaying-associations-rails-dumbo-web-111819-master
----.gitignore(642B)
----README.md(5KB)
----bin()
--------update(782B)
--------rails(141B)
--------bundle(129B)
--------spring(507B)
--------rake(90B)
--------setup(920B)
----public()
--------500.html(1KB)
--------robots.txt(202B)
--------422.html(2KB)
--------404.html(2KB)
--------favicon.ico(0B)
----Gemfile(1KB)
----db()
--------seeds.rb(343B)
--------migrate()
--------schema.rb(1KB)
----app()
--------views()
--------mailers()
--------models()
--------helpers()
--------assets()
--------controllers()
----.learn(68B)
----.rspec(11B)
----CONTRIBUTING.md(2KB)
----vendor()
--------assets()
----Gemfile.lock(5KB)
----config()
--------database.yml(552B)
--------spring.rb(111B)
--------environment.rb(128B)
--------cable.yml(116B)
--------environments()
--------application.rb(486B)
--------secrets.yml(965B)
--------locales()
--------boot.rb(128B)
--------initializers()
--------routes.rb(225B)
--------puma.rb(2KB)
----LICENSE.md(1KB)
----spec()
--------views()
--------models()
--------rails_helper.rb(3KB)
--------spec_helper.rb(4KB)
--------controllers()
----config.ru(153B)
----lib()
--------tasks()
--------assets()
----Rakefile(249B)

网友评论