ActionController :: UnknownFormat when using response_to do | format |

I am using jquery slider ui and rails 4. I am trying to implement a price slider for my product page. However, I ran into a problem. I tried to search around, but I can not find a solution that helps. Hope someone can help me as I'm brand new to rubies on rails. Thanks.

Here is my code

products_controller.rb

 respond_to do |format|
  format.js do
    render :update do |page|
      page.replace_html 'x_product_list', :partial => 'products/products_list', :locals => { :product => @product }

with this error:

ActionController :: UnknownFormat

+4
source share
1 answer

Try updating JS to config/initializers/mime_types.rb, so the rails know how to deal with it.

Mime::Type.register "application/javascript", :js

Be sure to restart the application after editing this file.

0
source

All Articles