词汇:comment

n. 评论;意见;批评

相关场景

we're gonna create a link reference here to manifest just exists here as a comment that you can reference. We're gonna turn the manifest on in our route file as well.
>> Rails 8.0.1 You are in good company
Common system is of course these as well, let's add one of those comments, and now we have the entire application running in production, wasn't that easy?
>> 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
Now, let's set things up to be dynamic, such that when we add a new comment to one of these, it's going to update the other as well. This is how we use web sockets in Rails using action cable, one of the frameworks that we have to create updates that are distributed automatically without folks having to reload their browser.
>> Rails 8.0.1 You are in good company
When it is nested, we get the fact that it's gonna be slash post slash on slash comments, and we have the association is set up nicely. Now, let's reload! Now it works, we have our comments field underneath. we can add the first comment. And as you can see here, this is my first comment a second ago that was the local time doing its time ago conversion.
当它被嵌套时,我们得到的事实是,它将是斜线后斜线对斜线注释,并且我们已经很好地建立了关联。现在,让我们重新加载!现在它工作了,我们在下面有我们的评论字段。我们可以添加第一条评论。正如你在这里看到的,这是我一秒钟前的第一条评论,当时当地时间正在进行时间转换。
>> 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
And your comment is just be a text area for content. We could have made this a rich text field as well, but let's keep things simple and just keep it in plain text!
>> Rails 8.0.1 You are in good company
And then finally, let's paste in the form that we're gonna use. That form is going off a model, the new comment, but it's nested underneath the post, is that we automatically can deduce which URL that we should post this new form to.
>> Rails 8.0.1 You are in good company
time_tag comment.update_at, "data-local": "time-ago"
>> 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
The comments is something that belongs to a post, and we will pull out the post ID from the params, that's what's being parsed in as part of the URL, and we will fetch that post, and now we will create the comments associated with that post based on the parameters that are expected as comment content. And then after it's created, we will direct back to the post!
>> 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
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
rails g resource comment post:reference content:text
>> Rails 8.0.1 You are in good company
Focus on offering follow up comments and questions to keep the conversation flowing.
专注于提供后续评论和问题,以保持对话的流畅。
>> ARE chat formula
Therefore, your heinous comment will be stricken from the record.
>> Madagascar (2005)Movie Script
Comments are longer, usually in print, and interpret and give extra information. They state an opinion and do so in a longer way than a remark. However, comments can be spoken: "Mr. President, would you mind commenting on today's deal with the labor union?" In this case, the president would not say "It's great." I suppose he could, but at the level of president, a comment should be lengthy and should help people understand something. If the president were to respond "It's great" my guess would be people present would laugh, as they would be expecting something of more substance than a throw away remark. So in the above example, the president might speak for a few minutes. Comments would not be statements about what the deal was, but would be his interpretation of what the deal means, implications for the job market, and why he supports or doesn't support it.
>> 2024-10 The metamorphosis from anxious wife
Mr. Sanzaki, you must have at least one comment.
>> 为人师表 Stand and Deliver (1988) Movie Script
Sidi... I love you It will not complete Can not be completed ! This is illogical With you, the investigator has been giving you permission engaged ! Shot Are you okay? - For - O client has been canceled your comment Thank you, sir Your job has been canceled It is unlocked now Thank you, sir "(We have managed it, I've been able to (Alexander Pearce" Where?
>> 致命伴旅 The Tourist (2010) Movie Script