0

我想在文件中加载一些 JavaScriptdevise/registrations/edit.html.erb文件。我尝试使用

<% content_for(:head) do%>
   <%=javascript_include_tag js_files%>
<%end%>

但文件未加载到应用程序中。我使用此代码在应用程序的其他视图中加载更多文件,它们运行良好。这是因为我试图在设计视图中加载 js 文件吗?如果是这样,有解决方案吗?

编辑:生成的 HTML

<!DOCTYPE html>
 <html>
  <head>
    <title>MyWeb</title>
    <link href="/stylesheets/application.css?1360746034" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/jquery-ui.css?1353919889" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/jquery.tagsinput.css?1360746034" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/scaffold.css?1353919889" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/token-input.css?1353919964" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/token-input-facebook.css?1353919964" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/token-input-mac.css?1353919964" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/application.css?1360746034" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/token-input-facebook.css?1353919964" media="screen" rel="stylesheet" type="text/css" />
    <script src="/javascripts/application.js?1360921167" type="text/javascript"></script>
<script src="/javascripts/jquery.observe_field.js?1360746034" type="text/javascript"></script>
<script src="/javascripts/jquery.jscrollpane.min.js?1360746034" type="text/javascript"></script>
    <script src="/javascripts/jquery.mousewheel.js?1360746034" type="text/javascript"></script>
    <script src="/javascripts/jquery.tokeninput.js?1360746034" type="text/javascript"></script>

    <meta name="csrf-param" content="authenticity_token"/>
    <meta name="csrf-token" content="RebGwNJKiIOwloQ0Y4VA4eSc92rIczA4zuV1kx07mho="/> 
   </head>
  <body>

    <div id="user_content">
    <h2>Edit User</h2>

    <form accept-charset="UTF-8" action="/users" class="user_edit" id="user_edit" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="RebGwNJKiIOwloQ0Y4VA4eSc92rIczA4zuV1kx07mho=" /></div>


    <p><label for="user_email">Email</label><br />
    <input id="user_email" name="user[email]" size="30" type="text" value="prueba@prueba.com" /></p>

    <p><label for="user_password">Password</label> <i>(leave blank if you don't want to change it)</i><br />
    <input id="user_password" name="user[password]" size="30" type="password" /></p>

    <p><label for="user_password_confirmation">Password confirmation</label><br />

   <input id="user_password_confirmation" name="user[password_confirmation]" size="30" type="password" /></p>

    <p><label for="user_current_password">Current password</label> <i>(we need your current password to confirm your changes)</i><br />
    <input id="user_current_password" name="user[current_password]" size="30" type="password" /></p>
    <p><input id="user_submit" name="commit" type="submit" value="Update" /></p>
    </form>
    <h3>Cancel my account</h3>

    <p>Unhappy? <a href="/users" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Cancel my account</a>.</p>

    <a href="http://localhost:3000/users/all_events">Back</a>

    </div>
    <div id="notice">       
    </div>

   </body>
 </html>
4

0 回答 0