词汇:schema
n. 图解;计划;模式;概要
相关场景
- So, let's run the migration for that, that sets up the comments table. You can see here the schema that we've now built up. We've added a number of tables for action text and action storage. And then, we have added a comments table. That's what you can see here. As we had it in the migration where we were just referencing the post as a foreign key, and then we had the content as text.>> Rails 8.0.1 You are in good company
- If we jump into the post model, you'll see there's actually nothing here. Everything in the post model is made available through introspection. So, a new post model will look at the schema for that table, and it will know that there is a title and there is a body, and we can access that title and that body directly through this post object.>> Rails 8.0.1 You are in good company
- That post is just going to have a title that's string and a body that's a text, and as you can see here from what's being generated, we have everything that we need to set up a basic interface for that scaffold. There is a migration that'll set things up in the database. There is a controller, there are views, there's a model, there's even testing stubs and adjacent API on top. So let's run that migration, and as you can see here, we created the posts in the main schema file, and now, we're ready to have a look at the application that was generated here with the post scaffold.>> Rails 8.0.1 You are in good company