有时候JavaScript运行完美,有时不会在轨道上的红宝石4 [英] sometimes javascript run perfect and sometimes not in ruby on rails 4

查看:350
本文介绍了有时候JavaScript运行完美,有时不会在轨道上的红宝石4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在日历中使用datepicker显示完美,但没有显示箭头按钮来更改月份。并且还会给出错误有时像这样:

  ActionController :: RoutingError(无路由匹配[GET]/ assets / images / ui -icons_ef8c08_256x240.png)



datepicker.js



($($)$($)$($)$ $ $ $ $ );

css
链接



抱歉太长时间的问题,告诉我,如果我想念某件事。 / p>

非常感谢提前



编辑:
我观察到我删除公共/资产目录,然后输入rake资产:预编译此时间错误未显示,但箭头仍未显示。

解决方案

p>默认情况下,它被添加到rails 4中看起来像是turbolinks问题。在turbolinks $(文件).ready并不总是触发。您可以在 railscast 查看有关turbolinks的更多信息和一些建议如何使用你可以添加到一些链接

  data:{no_turbolink:true} 
pre>

如果您不需要,您也可以从gemfile中删除turbolinks。还要检查您是否在

  / assets / images / 


I used datepicker in calendar it shows perfect but not shows the arrow button to change month. and also give error sometimes like this:

ActionController::RoutingError (No route matches [GET] "/assets/images/ui-icons_ef8c08_256x240.png")

datepicker.js

$(document).ready(function(){
  $('[data-behaviour~=datepicker]').datepicker();
});

css link

sorry for too long question and tell me if i miss something.

Big thanks in advance

Edit: I observed that when i delete the public/assets directory and then enter rake assets:precompile this time error is not showing but arrow still is not showing.

解决方案

It looks like turbolinks problem which are added to rails 4 by default. In turbolinks $(document).ready is not always firing. You can see more information about turbolinks and some suggestions how to use them here railscast or you can add to some links

data: { no_turbolink: true }

You can also just remove the turbolinks from gemfile if you don't need them. Also check if you have the ui-icons_ef8c08_256x240.png in

/assets/images/

这篇关于有时候JavaScript运行完美,有时不会在轨道上的红宝石4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆