词汇:so
adv. 如此,这么;确是如此
相关场景
- So that is a very quick tour of Rails, this is a wonderful way of getting started,just to use those scaffold generators and the authentication generators to get something going, get a Hello world out there, start working on your application, and before you know it, you might just be taking your application all the way from Hello World to IPO.
这是Rails的快速浏览,这是一种很好的入门方式,只需使用这些脚手架生成器和身份验证生成器即可开始工作,创建一个Hello world,开始开发你的应用程序,不知不觉中,你可能会把你的应用程序从Hello world一直带到IPO。>> Rails 8.0.1 You are in good company- SO now, we're created that user in production using our Kamal consol! I can log in with that user/pasword.>> Rails 8.0.1 You are in good company
- So, be careful when you create things, that are gonna be created on the server side in your real database.The database, by the way? we haven't talked much about that, and that is because we're using SQLite. So, there is nothing to configure,there's nothing to set up, SQLite is now a suitable database for production with Rails. we have tuned it with all the right pragmas,to run SQLite well in production, you of course still need to set up a way to back that up, but everything else is preconfigured for you.>> Rails 8.0.1 You are in good company
- So, it's no gonna show that button if we're not already authenticated, which is good because this layout is also used for login.>> Rails 8.0.1 You are in good company
- Now, if we hop back onto local host, and we try to log in with first the wrong password. we're actually gonna see something here , when I added the authentication, it added another gem, it added bcrypt, that's what we're using to keep password secure, so we have to hop back in here and restart our development server!>> Rails 8.0.1 You are in good company
- So that's just gonna be my email address and 123 password!We hop back into our CLI, and run rails db:seed, that's gonna run that file , I just showed you and set things up.>> Rails 8.0.1 You are in good company
- But as you can see here, it adds a handful of migrations, one for users, and one for sessions! So, we're gonna run rails db:migrate again!>> Rails 8.0.1 You are in good company
- What it does not give you is a signup flow, because that's usually quite specific to a given application. So, we leave that as an exercise for the reader!>> Rails 8.0.1 You are in good company
- So in production, you actually need to manually specify the route. So we can go down here, and uncomment this, that sets what the route is going to be, we're just gonna point it to post stud index.>> Rails 8.0.1 You are in good company
- And when you learn something it removes a little bit of the insecurity, so that it makes it slightly easier to try again.
当你们学到一些东西时,它会消除一点不安全感,这样就更容易再试一次。>> Confidence is action- We tried it with the predictable results and life is so much more fun this way too. I mean, who wants to spend their life trying to change people from their natural...>> we make silk purses out of silk
- 21:28:
- So this server exists on this address, servers web: - demo.exitsoftware.io ; proxy: host: alpha.exitsoftware.io; And I will then fill out the host as a C name to that machine. But we're using Alpha here, if I had deployed another application called Bravo to the same server, Kamal would set it up, so it's like I host two applications or any number of applications on that same server! Now, we will also need to have a look at the secrets here, that is in dockyml/secrets, because the register that I'm using, that is Docker Hub, needs of course a password, it is using my username but also needs a password.>> Rails 8.0.1 You are in good company
- So if we scroll down to the bottom here, we are ready. The first thing we're gonna do, we're gonna add a turbo stream from post to the show files to the show template.That's gonna set up the web socket connection and subscribe us to a channel named after that particular post that's pasted in.>> Rails 8.0.1 You are in good company
- We are pacing in the comment, and we're using that same time tag as we were using with the post, but this time, we are going to use time ago, so we get that nice two minutes ago on when something went posted rather than a local time spelled out with AM PM set up.>> Rails 8.0.1 You are in good company
- It'll automatically know that the comment model should map to view slash comment slash comment, so it can look up the right partial file to use. And then below that, we have the form that we're referencing with the comments new. So, let's hop in and paste in the individual comment. As you can see here, we just give it a div, that has a dom ID so that we can reference it.>> Rails 8.0.1 You are in good company
- 16:03:
- Now, we're also gonna add a number of partials here. This is the templating system, basically, a sub-routine that you can refer to. There's gonna be three of them that includes the entire comment section. We're gonna reference that in our post show in just a second. And within that, we're gonna refer to another partial for an individual comment, and another partial again for the new setup. So, let's paste some of that in here, You can see this for the entire collection, it just has an H2 for the comments, and we render the post comments. This again uses Rails' convention over the configuration approach.>> Rails 8.0.1 You are in good company
- So let's actually also create the other direction of this association. You saw a comment belongs to a post, but then we're also gonna make the post has many comments. Now, we have a bidirectional association that we can work with in both ways.>> Rails 8.0.1 You are in good company
- Alright, if we hop into that comments controller, it was empty. As you can see there, I'm gonna pay something in that actually makes this stuff work! You'll see one principle of the controller setup we have is that we have these callbacks. Before action, we're gonna set posts. So before all the actions, we're going to reflect the fact that this is nested resource.>> Rails 8.0.1 You are in good company
- 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
- We're G sipping or Brotliing this stuff so that it transports really quickly, but we're allowing you to view source on an entire application.>> Rails 8.0.1 You are in good company
- inspector:
- But really, what's unique here for Rails is the fact that we're using no build by default! So if I go over here in the inspector and look at the JavaScript files that are included,you can see we have the application js file with a little digest stamp on there. If we change anything that application js file, the digest is going to change, and the browser will redownload just the part!>> Rails 8.0.1 You are in good company
- zoo:
- And we will give it a format for what it should do with UTC timestamp, and turning it into a local time that we can have a look at.So if I reload here, you see it is November 13th, by the time of my recording at 3:28 PM in my local time zone, but actually underneath, the time tag is gonna be in UTC. That means we can cache this, and anyone around the world will still get the time displayed in their local time.>> Rails 8.0.1 You are in good company
- digesting:
- You don't need anything beyond what Rails ship you with already, because Rails 8 is all no build by default! That means there's not a transpiler, that means there's not a bundler, these files are shipped directly to the browser over HTTP2, so it's nice and fast. And the import map is what allows us to refer to these files by their logical names while still doing far future digesting, so that they load really quick,and such that they're easily compatible with CDNs and all that good stuff.
除了Rails已经提供的内容之外,你不需要任何东西,因为Rails 8默认情况下都是无构建的!这意味着没有转译器,也就是说没有打包器,这些文件通过HTTP2直接发送到浏览器,所以它既好又快。导入映射允许我们通过这些文件的逻辑名称引用它们,同时仍在进行未来的消化,这样它们加载得非常快,并且很容易与CDN和所有好东西兼容。>> Rails 8.0.1 You are in good company- So, we can do that using the import map pin command. And as you see, now that I hop back into our config import map, we've added the local text pin at the bottom, version 3.0.2. It pulled that straight off NPN, it downloaded that as a vendor dependency that we can check into our version control system. And now, we don't have any runtime dependency whatsoever on NPN, or anything else like that.>> Rails 8.0.1 You are in good company
- As you can see here, there is now a full WYSIWYG interface for creating the body. It comes with a default set of styles for the toolbar, you can change those, those styles are generated straight into your application, so you can make it look nice for yourself. Let's give some bold and italic text here, you see, that was all that was needed. but I think what's even nicer to look at here is if we do an upload and we add a file, you will see that file gets added with a preview directly to the WYSIWYG editor. And if we save that and we update the post, it is added to the post itself. And that then went through the whole process of doing a direct upload of the file when we dropped it into the editor, that uploads it straight to active storage. And then, we have access to that, and rendering it directly from whatever storage backend active storage is using. In this example , we're just storing on disk, but you could be storing your active storage in S3 or another object storage.>> Rails 8.0.1 You are in good company