词汇:all
adj. 全部的
相关场景
- Kamal:
- All right, that is very neat. Now, let's go to production! Because of course, you're not just here to create a Hello World app that runs on your own machine, you want to get this out into the world! And rails8 and forward ships with Kamal, a simple tool for deploying your web application anywhere.>> Rails 8.0.1 You are in good company
- And that is basically it. Now if I go over here and I add a comment to one of these, you see the comment was added on the left immediately at the same time. That's all web sockets automatically happening through action cable. And we can do it , of course the other way as well.>> Rails 8.0.1 You are in good company
- And if we hop into our comment, we can set up a broadcast_to for that post. The broadcast_to will broadcast all update made to that comment, whether a new comment is updated or an existing comment is changed in some way or even one deleted, and send it back out to a channel on action cable named after the post association that this comment belongs to!>> Rails 8.0.1 You are in good company
- All right, let's save that and hop back into our browser. Oop! I made a mistake here! When we generated the resource,it added a route for the new comments,but that route was not nested by default. We actually need to go into our routes.rb, that resource we added needs to be nested.>> Rails 8.0.1 You are in good company
- Now that we have that up, we can hop in and look it all up into the show action for the posts! That's gonna reference that common slot comments, that includes both the comments and the new form.>> 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
- Alright! Now let's add some comments to our blogging system! And I'm gonna use a different generator here,I'm gonna use a resource generator that is a little lighter than the one we were using for scaffold that doesn't generate a bunch of views, and doesn't generate all sorts of actions in the controller by default, but it does generate the new model that we need the comment model, it generates a migration for that, create comments ,and it generates just some empty placeholders for the comments controller and for the view action.>> Rails 8.0.1 You are in good company
- If you look at something like hey.com, you'll see this technique in use on a major application, and you can view all of the Javascript that we use to build that application, and that's the default for Rails.>> Rails 8.0.1 You are in good company
- But now that we've add that, let's have a look at our application JS file.That's the default setup that you have that the scaffold is going to use. And as you can see, we're using turbo-rails, we're including all the stimulus controllers, if we have any.>> 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 8.0.1 You are in good company
- Now, let's add a bit of custom JavaScript. Rails by default ships with Hotwire! Hotwire gives you Turbo, which is a way of accelerating page changes and updates is that your application will feel as fast and as smooth as a single page application without you basically having to write any JavaScript at all.>> 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
- But before we can do that, let's change the text area we had in the form here for our new post to be a rich text area. "form.rich_textarea :body". That's basically all you have to change, and let's save that and hop back into creating a new post.>> Rails 8.0.1 You are in good company
- Now , Rails has a bunch of different ways you can do the CSS, there's also a path where you can use Tailwind. Lots of people like that for good reason, and there are a bunch of different options, all the major CSS frameworks are available, but by default, we ship with a no build, as I said, intention and simple CSS just make things look prettier without having to adorn anything with classes, or what have you.>> Rails 8.0.1 You are in good company
- This is the thing you're gonna see, when you start up a new Rails application, it'll tell you which version you're on, both for the ruby version, the Rails version, and the Rack version. That's running on localhost:3000 by default. But if we do slash posts here, you'll see the scaffold interface that we generated. Now, this is the index action, the one we just looked at in the view and from the controller. But if we click the New, you see here we have form for creating the new post with its title and its body. it's quiet basic, to put it mildly right now, but all the actions are mapped out. This scaffold interface is not meant for shipping into production, it is meant to showing you how to build a Rails application with the basics, and then you make it look pretty, you make it look nice.>> Rails 8.0.1 You are in good company
- auxiliary police:
- Now if we hop over and start up our development server, you do that with just bin/dev. If we were running a Rails application that also had auxiliary watcher processes such as one for ES build or for Tailwind, bin/dev would start those as well. But this version of our Rails blog, is just going to be built with all vanilla, no build swt up so we only need to start the Puma, Ruby web server,and we can hop over into the browser and see here.>> Rails 8.0.1 You are in good company
- And then finally, we have the views that are being generated. If we hop in here and have a look at the index view, you can see this is where we will list all the posts that are in the system.>> Rails 8.0.1 You are in good company
- All post controllers follow the same convention. There are seven actions, you have index,show, new, edit, create and update and destroy! So there form a basic setup for configuring everything that's needed for a resource to be exposed to the web.>> Rails 8.0.1 You are in good company
- So, let's jump into the post controller first. The controller is really what guides all the inbound actions you get into a Rails application, you'll have the user hitting (slash)/posts or /post/new, and it gets routed into the posts controller!>> Rails 8.0.1 You are in good company
- Leijun:
- All the setbacks and failures you have experienced, even those seemingly meaningless things that waste time, will become your most important and precious wealth.>> Motivate yourself in the morning
- When you listen to tapes, listen with relaxed belief, believing that this can happen for you. And by listening to them, listen to them over and over and over again. And you will get a breakthrough, you can listen to the same tape for months and all of a sudden you hear something you never heard before, and have a special meaning for you. Or you can read the same book over again and you'll find some special insight, you said I can't believe I didn't see that the first time.>> Motivate yourself in the morning
- They have to do that , it's part of their life. If you mess that up you know. It makes everything else particularly hard. So and I heard a great speech from a woman once, who said you can have it all, you just can have it all at the same time.>> work hard but work smart
- You don't have to answer everything all at once. You know I tell all people Jade Morgan. Everyone should take your on their own, their mind, their body, their spirit, their soul, their family, their health.>> work hard but work smart
- You know you get your thoughts together, have a process in place for decision making. Don't allow yourself to become weaponized. Like at all you know or and don't have it to extend I have a temper. It works against you. You always have to end up apologizing.>> work hard but work smart
- I've got to hand to you for all your help.
我不得不感谢你的帮助。>> 47-A Thirsty Ghost