[英]ActionController::UnknownFormat when using respond_to do |format|
I am using jquery slider ui and rails 4. I am trying to implement a price slider for my product page. 我正在使用jquery滑块ui和rails 4.我正在尝试为我的产品页面实现价格滑块。 However, i have run into a problem.
但是,我遇到了一个问题。 I have tried to search around but i cant seems to find a solution that helps.
我试图搜索,但我似乎找不到有帮助的解决方案。 Hope someone could help me as I am quite new to ruby on rails.
希望有人可以帮助我,因为我对铁轨上的红宝石很新。 Thanks.
谢谢。
Here are my code 这是我的代码
products_controller.rb 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
ActionController的:: UnknownFormat
Try updating adding JS to config/initializers/mime_types.rb
, so rails knows how to deal with it. 尝试更新将JS添加到
config/initializers/mime_types.rb
,以便rails知道如何处理它。
Mime::Type.register "application/javascript", :js
Be sure to restart your app after editing that file. 编辑该文件后,请务必重启您的应用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.