Skip to content

button_to my_routed_path(a: "ok", b: "or", c: "not?"), remote: true does NOT call JS rendering #513

Open
@jerome-diver

Description

@jerome-diver

my partial _view:

= button_to "Do something good this day", my_rooted_path(a: "OK", b: "or", c: "NOT ?"), remote: true, class: "what ever"

my "my_routed_path" route:

my_routed /my/id:/a:(.:format) my#own_action

my_controller.rb (action part):

def own_action
   ... do something easy...
   repond_to do |f[
      f.html { render blablabla...}
      f.js { render layout: false } (or just f.js the same...)
end

i have a file named "my_own.js.coffee":

console.log("Very good !")

And at click time on button "Do something good this day"

i expect my rails-5.2.2 application to show me in the console log: "Very good !"...
but not. New page load the html render and yes, my rails puma server logs show me that it is html render who has been called.

Why ?

How to call JS from this button ? all the other "conventional" routed path are fine, so maybe it is a kind of ugly bug ? (not sure as long as i not understand why it doesn't call JS render and then render the action_named dot js dot coffee file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions