Rails 5 unknown format error in format.js

Viewed 76

I simply want to display a certain partial in my view when I click on a button. The probleme isn't really appending the partial but making the js file to work. I can't find a solution despite searching for hours.

Here is my view :

integration.html.erb

<%= render 'shared/onboarding/navbar' %>
<div class="onboarding-body col-sm-9 offset-sm-3 col-xs-12">
  <div class="login-wrapper">
    <div class="login-container">
      <div class="description-header">
        <img src="https://gal.img.pmdstatic.net/fit/http.3A.2F.2Fprd2-bone-image.2Es3-website-eu-west-1.2Eamazonaws.2Ecom.2Fgal.2F2020.2F03.2F07.2Fac38d496-fe62-4ceb-abe7-96fa944e3e66.2Ejpeg/480x480/quality/80/focus-point/410%2C222/nicolas-sarkozy-ce-discours-qui-a-mis-le-feu-a-son-entourage.jpg" alt="Présentateur" class="description-img" />
        C'est parti Franck !
        <br/>
        En quelques clics je vais vous aider à installer Logora sur votre site.
        <br/>
        Quelle est la technologies utilisée par votre site ?
      </div>
      <div class="row item-pick">
        <%= link_to image_tag("/onboarding/logo-wordpress.png"), integration_path(:technology => "wordpress"), remote: true, class: "technology-item" %>
        <%= link_to image_tag("/onboarding/internet.png"), integration_path(:technology => "standard"), remote: true, class: "technology-item" %>
      </div>
    </div>
  </div>
</div>

The link_to helpers calls the same method in my controller but with different params.

The method :

    @technology = params[:technology]
    if @technology
      respond_to do |format|
        format.js {render layout: false}
      end
    end
  end

And I have added an integration.js.erb in my views folder to be triggered (it only contains a console.log as I just want it to work). When I click on one of my link_to the console fires a :

ActionController::UnknownFormat

Anyone has any clue about my issue ?

0 Answers
Related