有人可以向我解释为什么会这样吗?我把我的内容包装在Bootstrap响应div中,而我的表格里面的div宽度大于容器.
<div class="row">
<div class="col-md-4">
<table class="table">
<tbody>
<% @user.each do |user| %>
<tr>
<td><%= user.content %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
问题是如果我有一个非常大的内容与很多字符,表变得比它的容器宽得多<div class="col-md-4">.如何实现它的内容包装到另一行而不是破坏布局?谢谢您的帮助!
我有一个表单,我通过AJAX提交,所以服务器的预期响应格式是javascript.问题是我无法像这样进行验证工作.通常我会这样做:
# POST /cats
# POST /cats.json
def create
@cat = Cat.new(cat_params)
respond_to do |format|
if @cat.save
format.html { redirect_to @cat, notice: 'Cat was successfully created.' }
format.json { render action: 'show', status: :created, location: @cat }
else
format.html { render action: 'new' }
format.json { render json: @cat.errors, status: :unprocessable_entity }
end
end
end
Run Code Online (Sandbox Code Playgroud)
但现在我有这样的情况:
# POST /cats
# POST /cats.json
def create
@cat = Cat.new(cat_params)
respond_to do |format|
if @cat.save
format.js { }
else
format.js { ????? } …Run Code Online (Sandbox Code Playgroud)