Hacker Newsnew | past | comments | ask | show | jobs | submit | 023984398's commentslogin

1st amendment denier


also I'm not a dem apologist but this is just Fox News regurgitation from this guy. F both parties


[flagged]


I get it - you love Republicans and hate Democrats. I hate them all. Can you just connect a few more neurons in your brain and rise above it for a little bit and consider the costs? We're losing our rights and seeing a test of them live on video. Assuming we have elections again this can be used by both. Wake up dude.


[flagged]


Honestly I haven’t seen that video before now but are you kidding me? First of all cars don’t break like that from a kick. Second of all where’d the ford logo on the car go? Clearly AI. Classic AI video tells, it’s not even subtle.

Sad for you that you fell for it but not expected. If you don’t see murder in the original cell phone videos, you’ll rationalize this any way you can.


This is the world we live in now I guess, where everything you don't like is AI


That's not what I said, I said I've witnessed AI cars explode like that, but I've never seen a real car explode like that. Ask yourself the simple question: where is that car? If that happened, let's see the actual car up close. Let's actually get a shot of that damage that occurred. We'll never see that because that car is not damaged in that way, because this thing is false.

> where everything you don't like is AI

This is projection. You're doing the same thing in reverse -- treating AI output with credulity because you want to believe it.


Ummm ok then...will leave it there.


The person who murdered Laken Riley was not acting on behalf of the government. That is the difference. Do you see the difference?


Also that Laken Riley is the only example ever provided for why immigrant violence is such an issue reveals it’s actually not an issue.


bad take


Accurate take


head in sand take. stop listening to propaganda.


Citing an AI tweet hardly screams accurate. They're killing American citizens with immunity. Enjoy the taste of boot leather in your mouth dude.


[flagged]


There are untrained MASKED federal agents killing American citizens. They pistol whipped Alex Pretti before shooting him. This is not normal. I think its appropo.


> Calling ICE "gestapo" and Trump "Hitler" and are genuinely crazy things, gestapo can be pretty accurately described by 1984 as the thought police, ICE, while being an organ of a state is far from that.

I'm not sure what you mean. The Gastapo was an organ of the state. Geheime Staatspolize means "Secret State Police."


Hard disagree about ICE as Gestapo. ICE is Trump's secret police, loyal to him, accountable to him.

I suppose Gestapo did have more menacing uniforms.


The gestapo didn't wear masks, so there's that difference.


[flagged]


According to your own numbers, Clinton and Obama managed to to deport 15 million people, and somehow they managed to do it without executing any citizens in the street.


I dont think you read the original grandparent comment. There absolutely reasons why the chaos is happening now and not under Clinton or Obama.


No one is killing American citizens with immunity - except ICE. The man who killed Laken Riley is in Prison. https://en.wikipedia.org/wiki/Murder_of_Laken_Riley. Where are the masked agents who killed Renee Good and Alex Pretti?


You send in the Calvary to get this straw Juan of yours, you don’t sick them on the state of Minnesota


Who the hell is arguing for their immunity? If anyone commits a murder, they should be put in jail.

Everyone within the borders of the United States has rights, even if they're here illegally. That's what it means to be a free country.


This is awesome and I'm glad Rails is adding something official here. Unfortunately if you want to use the Dockerfile in development with docker-compose you will need to make some changes/additions. Most notably: only precompile assets if deploying, not during development


This is cool but its not using hotwire (turbo frames / turbo streams)


It does! Stimulus 2 is Hotwire too[0].

Turbo seemed more connected with existing models, and so I chose a Stimulus controller instead. But maybe I just don't know Turbo as much yet.

[0] https://stimulus.hotwire.dev/


The whole idea of Hotwire is to prevent `Rails.ajax` calls. You can easily accomplish this with less code:

1. Replace the `output` target with a Turbo frame. 2. Add a value to the `data-controller` div with a `preview-url`: https://stimulus.hotwire.dev/reference/values 3. Change the `Rails.ajax` call with `let url = URL.new(this.previewUrlValue); url.searchParams.append('body', this.tweetTarget.value; this.outputTarget.src = url.toString();` 4. Change the `preview` action to render HTML with the same frame.

Now you have an automatic refreshing frame with less code.


There are a lot of ways to skin this cat!

You can also have a hidden form submission that does this from the existing controller so you don't need to specify the URL.

For example, you can add a hidden submit button like

  form.submit 'preview', data: { composer_target: 'submit' }, hidden: true
Instead of a stimulus target, you wrap your preview area in a turbo frame

  <turbo-frame id="output">
  ...
  </turbo-frame>
In your (ruby) controller you can re-use the existing controller action:

  def create
    @post = Post.new(post_attributes)
    preview && return if params[:commit] == 'preview'
    ...
  end
Do the turbo junk in a private method for the preview:

  private

  def preview
    render turbo_stream: turbo_stream.replace(
      'output', partial: "posts/preview", locals: { post: @post }
    end
  end

Your stimulus controller now just does this:

  preview() {
    this.submitTarget.click();
  }
I'm not sure which I prefer!


Yep, that's what actually cross my mind first. In the end, I wanted to avoid depending on the model, but it's certainly interesting.


Once the complexity ramps up and the side effects compound, that's when I really appreciate server side rendering. And incidentally, that's exactly when I like to have the whole model!

I just refactored some old jquery stuff to use turbo and stimulus on a really complex form and it turned out well, I think. But below a certain level of complexity, it would have made sense to just do everything directly in stimulus with no AJAX at all.

I know your preview example is contrived (it's tough getting a real-world representative demo into a blog post, so please don't read this as criticism, I don't mean to say it's a bad example and I'm not trying to pick on it!) but really simple use cases are exactly the "sweet spot" for doing everything directly in the browser using Stimulus without having to call back to the server. Only once you start piling in business logic or reshuffling major parts of the display around does it fully pay off, and that's also about when you'll start appreciating having the whole model and the ability to re-use partials (rather than having to pick off a few pieces manually).

EDIT:

And just to be clear, in the sample code I put in above, you don't actually have to use the model. You can always just shove a single parameter into a special partial and go.


Perfect. I will try it, and perhaps update the post with this approach as well. Thank you. I haven't done anything with Turbo yet, although it's my next step. I first just tried to refresh my Stimulus knowledge with the 2.x changes.

But as for the AJAX call, I still think it's quite simple solution that most will instantly understand (and that's a good thing).


> "I will try it, and perhaps update the post with this approach as well."

this would be very useful, as there are not many comparative articles that really help you choose one approach over another. a number of years ago, i went through a couple rounds of turbo vs. ujs vs. websockets vs. custom js vs. something other library i don't remember atm, to try to figure out the best option for the app i was working on. lots of articles talk about the strengths of a library compared to others, but almost none walk through an example (or two) with enough depth to show those differences explicitly.


I included a second example with Turbo Frame that hopefully shows how Turbo Frames work.


I mean technically they are installed but the example is still using UJS and not the functionality provided by the hotwire libs.


Yes, I was only focusing on Stimulus 2, but someone else posted here how to change the example to use a frame.


At least in the non-rails environment, Turbo and Stimulus are two separate libraries and have to be included individually.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: