Rails 渲染不必要的信息 [英] Rails in rendering unnecessary information

查看:50
本文介绍了Rails 渲染不必要的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 RoR 和 Bootstrap,我正在尝试将我的代码呈现为我在网上找到的代码段.基本上我的索引中有这个:

 <%= @companies.each do |f|%><div class="col-md-6"><div class="well well-sm"><div class="row">...<p><%= f.name%></p><p><%=f.description%></p>...

<%结束%>

但是,它正在呈现关于应该以这种格式呈现的每个项目的批量信息:

[#]

如果有人能给我任何提示,那就太好了.至少告诉我一些关于这个渲染代码的格式,那会很棒.

解决方案

这里

 <%= @companies.each do |f|%>

删除=

 <% @companies.each do |f|%>

I have been using RoR along with Bootstrap and I am trying to render my code into a snippet I found it online. Basically I have this in my index:

 <%= @companies.each do |f| %>
        <div class="col-md-6">
            <div class="well well-sm">
                <div class="row">
                   ...
                       <p><%= f.name %></p>                       
                       <p><%= f.description %></p>
                        ...        
                </div>
 <% end %>
             </div>
          </div> 

However, it is rendering the bulk information about each item that was supposed to be render in this format:

[#<Company id: 30, name: nil, description: nil, ....., locations: nil, user_id: 3, chosenindustry_id: nil>]

If someone could give me any hints at all that'd be great. At least tell me a little about what format this rendered code, that'd be amazing.

解决方案

Here

 <%= @companies.each do |f| %>

just delete =

 <% @companies.each do |f| %>

这篇关于Rails 渲染不必要的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆