我在html.erb中遇到了if,elsif,else语句的问题.我在erb中看到了很多关于if/else语句的问题但没有包含elsif的问题,所以我想我会请求帮助.
这是我的html.erb:
<% if logged_in? %>
<ul class = "nav navbar-nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Account <b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right">
<li><%= link_to "Profile", current_user %></li>
<li><%= link_to "Settings", edit_user_path(current_user) %></li>
<li class="divider"></li>
<li>
<%= link_to "Log out", logout_path, method: "delete" %>
</li>
</ul>
</li>
</ul>
<% elsif has_booth?(current_user.id) %>
<ul>
<li>TEST</li>
</ul>
<% else %>
<ul class="nav navbar-nav pull-right">
<li><%= link_to "Sign Up", signup_path %></li>
<li><%= link_to "Log in", login_path %></li>
</ul>
<% end %> …Run Code Online (Sandbox Code Playgroud) 我试图在某个动作后更新对象的属性.如果我使用update_attribute,一切都正确地保存到数据库,但我有很多东西需要更新,所以它变得非常重复.
这很好用:
order.update_attribute(:order_completed, "true")
order.update_attribute(:stripe_email, params[:stripeEmail])
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用update_attributes时,我的数据不会保存到db.
这是代码:
order.update_attributes(order_completed: "true", stripe_email: params[:stripeEmail])
Run Code Online (Sandbox Code Playgroud)
有谁看到我的错误在哪里?从我读过的所有应该有效的东西.谢谢你的帮助!
所以,我正在使用带有rails的bootstrap,我已经从bootstrap文档中输入了正确的代码,但这不起作用.我也从其他项目中输入代码,但我的问题仍然存在:我无法将我的jumbotron变为全宽(浏览器).
这是我尝试过的.
我被卡住了.我想知道我在Rails应用程序中设置Bootstrap的方式是否有问题.我要粘贴下面的代码.任何帮助总是受到赞赏.在此先感谢,互联网.
HTML:
<div class="jumbotron">
<div class="container">
<h1>Welcome to Sewingly</h1>
<p>A community marketplace for knitters, sewists, and other needle artists.</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
@import "bootstrap-sprockets";
@import "bootstrap";
html {
overflow-y: scroll;
}
body {
padding-top: 60px;
background-color: #fefefe;
}
.jumbotron {
background-image: url(http://i1216.photobucket.com/albums/dd370/kjames1581/jtronnew.jpg);
height: 250px;
color: white;
background-repeat: no-repeat;
background-size: cover;
border-radius: 0 !important;
font-weight: bold;
text-align: center;
margin-top: -9px;
p {
color: white;
}
}
js:
//= require jquery
//= require jquery_ujs
//= require …Run Code Online (Sandbox Code Playgroud) 我使用Bootstrap创建了一个响应式网站.问题是,如果一个人滚动到任何一方,该网站随之移动.
我在我的application.html.erb中有这个:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
Run Code Online (Sandbox Code Playgroud)
以下是它的外观:

如果有人能指出我正确的方向,我会很感激.
谢谢!
erb ×1