GithubHelp home page GithubHelp logo

Comments (4)

dhh avatar dhh commented on June 5, 2024 2

Yeah, going to come up with a way to fix this. Right now you do need that empty response. You can also do { render turbo_stream: "" }. But it's ugly as well. We'll find a better way.

from turbo-rails.

j-sieg avatar j-sieg commented on June 5, 2024 1

I think you can get it to work if you remove the stimulus controller and just use
<%= button_to 'Delete', user_path(user), method: :delete %>

from turbo-rails.

dhh avatar dhh commented on June 5, 2024

By doing a remote link that's triggering a fetch outside of Turbo, you're not going to be sending an Accept header that includes turbo stream. So you'll be hitting either the html or json formats. What @j-sieg said is the way to go. It's better for a11y to use real forms for actions anyway.

from turbo-rails.

bborn avatar bborn commented on June 5, 2024

Is a head :ok the right thing for the server to respond with here? If so, would it make sense for turbo-rails to provide a default? Otherwise, if you do this:

def destroy
  def destroy
    @message = Message.find(params[:id])
    @message.destroy

    respond_to do |format|
      format.turbo_stream 
    end
  end

Then you have to provide a blank destroy.turbo_stream.erb to avoid getting a missing template error.

from turbo-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.