词汇:controller

n. 控制器;管理员;主计长

相关场景

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
variant:
But oh yeah! Let's show you real quick here,if you do a /post.json, you're gonna get that automatic API as well, as I showed you in the controller, there are two different paths, you have HTML, and you have JSON. You could also have added XML in there or another path, but by default, you just get these two different variants, the HTML and the JSON variant.
>> 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
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
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
Is the business logic in the controller making it hard to read / use? You dont need to extract it out to modules as a kneejerk reaction. If you feel friction, find a way to reduce the friction. You never know less about your app than you do right now, so waiting is often the right move.
控制器中的业务逻辑是否使其难以阅读/使用?你不需要把它作为下意识反应提取到模块中。如果你感觉到摩擦,找到一种方法来减少摩擦。你永远不会比现在更了解你的应用程序,所以等待通常是正确的选择。
>> 2024-10 The metamorphosis from anxious wife
Finally, when a client disconnects from the room channel, a Turbo Stream update removes the media element from the screen. The media controller broadcasts its removal so the room controller can clean up.
最后,当客户端与房间频道断开连接时,Turbo Stream更新会从屏幕上删除媒体元素。媒体控制器广播其移除,以便房间控制器可以进行清理。
>> webRTC Hotwire and Ruby on Rails
Anyway, the code for this has been mostly lifted from the spec and handled by the Signaller /WebrtcNegotiation. When creating the negotiation, the room controller listens for track events on the TRCPeerConnection, so it can start streaming from the remote client.
无论如何,此代码大多是从规范中提取的,由Signaler/WebrtcNegotiation处理。创建协商时,房间控制器会监听TRCPeerConnection上的跟踪事件,以便它可以从远程客户端开始流式传输。
>> webRTC Hotwire and Ruby on Rails
It's important we do this first so that it's ready for incoming streams. The medium controller messages the room controller to notify that it has been added. This begins the WebRTC negotiation to form a connection between the two clients.
重要的是,我们首先要这样做,以便为传入流做好准备。介质控制器向房间控制器发送消息,通知其已被添加。这将启动WebRTC协商,以在两个客户端之间建立连接。
>> webRTC Hotwire and Ruby on Rails
The Stimulus room controller handles Enter button click.It gets the user's local audio and video and feeds them into the local video element. It also starts Action Cable subscriptions specific to the current room: one for communicating WebRTC messages: the Signaller; and one for clients to ping others: the RoomSubscription.
Stimulus控制器处理Enter按钮的点击。它获取用户的本地音频和视频,并将其送到本地视频元素中。它也启动了在针对当前room的 Action Cable 订阅(signaling subscription and room subscription)分别处理webRTC消息和ping其他客户端。
>> webRTC Hotwire and Ruby on Rails
[We see Miek and Korg sitting on a couch, PlayStation controller in hand, playing Fortnite and eating chips.]
>> Avengers: Endgame 复仇者联盟4:终局之战 Movie Script
We're opening up the controller now.
>> Pearl Harbor: Into The Arizona 珍珠港:亚利桑那号探秘(2016) Movie Script
Every motor speed controller and position relay has a 20 amp auto reset circuit breaker.
>> Spare Parts 拼凑梦想 (2015) Movie Script
Okay, controllers are reliable now.
>> Spare Parts 拼凑梦想 (2015) Movie Script
You know, the micro-controllers, the fuse panel, the battery as a kind of command center.
>> Spare Parts 拼凑梦想 (2015) Movie Script
Sorry, we can't do anything without the fuse panels, or the micro-controllers, or the batteries, or the laser tape measure.
>> Spare Parts 拼凑梦想 (2015) Movie Script
INT. TOWER - NIGHT Air controllers leave as Kramer continues.
>> 飞机 Airplane! Movie Script
INT. TOWER - NIGHT Kramer sighs in relief as controllers and Mrs. Oveur dash from room.
>> 飞机 Airplane! Movie Script
STRIPED CONTROLLER Captain McCroskey, this is Captain Roberts. Captain Kramer, this is Captain Colosimo. Captain Hinshaw, Captain Gatz.
>> 飞机 Airplane! Movie Script
STRIPED CONTROLLER We're all ready, sir.
>> 飞机 Airplane! Movie Script
AIR CONTROLLER #2 Chief, look at this!
>> 飞机 Airplane! Movie Script
KRAMER:
I know. I know. But it's his ship now, his command; he's in charge, he's the boss, the head man, the top dog, the big cheese, the head honcho... Air Controller #2 rushes up to McCroskey and Kramer, carrying a newspaper.
>> 飞机 Airplane! Movie Script
AIR CONTROLLER #2 Bad news. The fog's getting thicker.
>> 飞机 Airplane! Movie Script
INT. DISPATCH - NIGHT Air Controller #2 enters.
>> 飞机 Airplane! Movie Script