您好我正在尝试为我已包含的基于登录的bootstrap模式弹出窗口呈现 在我的_header.html.erb文件中,如下所示
<div class="modal hide fade" id="login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Log in</h3>
</div>
<div class="modal-body">
<%= link_to "View", signin_path %>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
但是我没有在屏幕上显示任何登录按钮但是当我尝试查看我的网页的源代码时,我的链接如下所示。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Skillable App </title>
<!-- Javascripts
================================================== -->
<script src="/assets/jquery.js?body=1"></script>
<script src="/assets/bootstrap-transition.js?body=1"></script>
<script src="/assets/bootstrap-affix.js?body=1"></script>
<script src="/assets/bootstrap-alert.js?body=1"></script>
<script src="/assets/bootstrap-button.js?body=1"></script>
<script src="/assets/bootstrap-carousel.js?body=1"></script>
<script src="/assets/bootstrap-collapse.js?body=1"></script>
<script src="/assets/bootstrap-dropdown.js?body=1"></script>
<script src="/assets/bootstrap-modal.js?body=1"></script>
<script src="/assets/bootstrap-scrollspy.js?body=1"></script>
<script src="/assets/bootstrap-tab.js?body=1"></script>
<script src="/assets/bootstrap-tooltip.js?body=1"></script>
<script src="/assets/bootstrap-popover.js?body=1"></script>
<script src="/assets/bootstrap-typeahead.js?body=1"></script>
<script src="/assets/bootstrap.js?body=1"></script>
<!-- Stylesheets
================================================== -->
<link href="/assets/application.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/bootstrap-responsive.min.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/bootstrap.min.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/companyrating.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/custom.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/global.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/pages.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/user_session.css?body=1" media="screen" rel="stylesheet" />
<link href="/assets/users.css?body=1" media="screen" rel="stylesheet" />
<meta content="authenticity_token" name="csrf-param" />
<meta content="/UOprUnr0t8ItxVtX1Yc1GaaX3zgs2/kCFicNAtWM68=" name="csrf-token" />
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
<![endif]-->
</head>
<body>
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<a href="/" id="logo">SAMPLE</a>
<nav>
<ul class="nav pull-right">
<li><a href="/">Companies_list</a></li>
<li><div class="modal hide fade" id="login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Login</h3>
</div>
<div class="modal-body">
<a href="/signin">View</a>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div></li>
</ul>
</nav>
</div>
</div>
我还使用了&lt;%= render“/sessions/new.html.erb"%>但我收到以下错误
ActionView::MissingTemplate in Pages#companies_list
Showing /home/seshendra/rails_app-master/app/views/layouts/_header.html.erb where line #22 raised:
Missing partial sessions/new.html.erb with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/home/seshendra/rails_app-master/app/views"
<%= render "/sessions/new.html.erb"%>
任何人都可以告诉我如何解决它。我完全是一个新手,我通过这个网站http://raycoding.net/2012/10/30/creating-social-network-on-ruby-on-rails-day-5-navigationstwitter-bootstrap-stylesjquery-part-2/
答案 0 :(得分:0)
尝试删除路径上的第一个斜杠(&#39; /&#39;) 使用
<%= render "sessions/new.html.erb" %>