Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 Rails文件选择器,显示3个按钮,而不是1个_Ruby On Rails 4_Filepicker.io - Fatal编程技术网

Ruby on rails 4 Rails文件选择器,显示3个按钮,而不是1个

Ruby on rails 4 Rails文件选择器,显示3个按钮,而不是1个,ruby-on-rails-4,filepicker.io,Ruby On Rails 4,Filepicker.io,使用Rails 4.2.4 我在rails中生成了一个脚手架来测试filepicker。一切似乎都很好,除了当我在页面上点击“刷新”按钮时,页面上显示了3个按钮,而不是原来的1个。这在Safari和Chrome上都会发生。谁能告诉我怎么解决这个问题吗 首次加载页面时,一个按钮: 刷新时: application.html.erb来源: <!DOCTYPE html> <html> <head> <title>FilepickerTest&l

使用Rails 4.2.4

我在rails中生成了一个脚手架来测试filepicker。一切似乎都很好,除了当我在页面上点击“刷新”按钮时,页面上显示了3个按钮,而不是原来的1个。这在Safari和Chrome上都会发生。谁能告诉我怎么解决这个问题吗

首次加载页面时,一个按钮:

刷新时:

application.html.erb来源:

<!DOCTYPE html>
<html>
<head>
  <title>FilepickerTest</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>

<%= filepicker_js_include_tag %>
<%= yield %>

</body>
</html>
...
<div class="field">
  <%= f.label :filepicker_url %><br>
  <%= f.filepicker_field :filepicker_url, :button_text => "Select Image", :button_class => "btn btn-default", :onchange => 'onImageUpload(event)' %>
</div>
<div class="actions">
  <%= f.submit 'Upload Image' %>
</div>
...

文件选择器测试
正确%>
正确%>
_form.html.erb来源:

<!DOCTYPE html>
<html>
<head>
  <title>FilepickerTest</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>

<%= filepicker_js_include_tag %>
<%= yield %>

</body>
</html>
...
<div class="field">
  <%= f.label :filepicker_url %><br>
  <%= f.filepicker_field :filepicker_url, :button_text => "Select Image", :button_class => "btn btn-default", :onchange => 'onImageUpload(event)' %>
</div>
<div class="actions">
  <%= f.submit 'Upload Image' %>
</div>
...
。。。

“选择图像”,:button_class=>“btn btn default”,:onchange=>“onImageUpload(事件)”%> ...
该问题与turbolinks相关,通过删除application.html.erb文件中的javascript调用解决。

该问题与turbolinks相关,通过删除application.html.erb文件中的javascript调用解决。

我知道您正在使用turbolinks。也许是相关的。天才!取出turbolinks解决了这个问题。谢谢。@TommyJ请为您的问题添加一个答案,并将其批准为已接受的答案。我看到您正在使用TurboLink。也许是相关的。天才!取出turbolinks解决了这个问题。谢谢。@TommyJ请为您的问题添加一个答案,并将其批准为已接受的答案。