Code Monkey home page Code Monkey logo

Comments (5)

dvodvo avatar dvodvo commented on May 27, 2024 1

The naming conflict was the root problem, but not the one described above. A class attribute's name was the same of a class goverend by a has_many relationship (initially this had not been specified in the model). Once specified, the record was no longer creatable and the processing reverted to HTML.

from rails.

yshmarov avatar yshmarov commented on May 27, 2024

Are you sure that your controller action has a format.turbo_stream response?

If it is not found, it will try to respond with format.html instead.

P.S. data: { remote: true } has no effect in rails 7

from rails.

dvodvo avatar dvodvo commented on May 27, 2024

Definitive.
I run the controller •without• mentioning format, in order to default processing the rails way ...
If there is no view with the turbo_stream format, the 'html' file is then rendered.
In both cases, however, the logging will be
Processing by PartisController#create as TURBO_STREAM .
Something in this controller is forcing the processing to got to HTML...

from rails.

smitssjors avatar smitssjors commented on May 27, 2024

I belive rails determines the content type based on the Accept header. If it includes text/vnd.turbo-stream.html the request will be handled as a TURBO_STREAM.

You can check the request header using the browser or with logger.debug request.headers["Accept"] in the controller action.

from rails.

dvodvo avatar dvodvo commented on May 27, 2024

well the content type is being established as HTML
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
and not the default TURBO_STREAM.

I've tried many variants, trying unsucessfully to override... Now <%= form_with( url: create_consumers_partis_path, data: {turbo: true}) do |form| %> which renders in HTML <form data-turbo="true" ... but it still processes to HTML...

So something is diverting the normal process.

update I worked on the assumption of some naming conflict: there are multiple classes who are compounds (Parti, ConsumerParti, GroupParti), as well as compounded named actions ('create_consumers') which might be generating routing confusion, and thereby diverting the intended processing method. Having eliminated potential conflicts derived from action names, the behaviour remains stuck to HTML processing for any action that regards the Parti, ConsumerParti, GroupParti classes

from 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.