English 中文(简体)
姓名:家庭指数
原标题:NameError in Home#index

我正试图在我的主页上展示我的职位。 但是,如果出现错误,“家庭指数中的错误”。 在这里,这部法典是新法典,因此,我看着这个法典。 我曾尝试使用“查特普”,似乎没有任何帮助。 是否有任何建议?

页: 1

Home Controller:
    def set_stories    
       @stories = List.where(user: [current_user])
    end
   


Index View (index.html.erb):
    <div class="d-flex flex-column gap-3">
        <!-- Story Section Start -->
         <% @stories.each do |stories_list| %>
          <%= render  story/stories_list , stories_list: stories_list %>
    <% end %>



Partial for Story List (_stories_list.html.erb):
     <div class="card d-flex flex-row align-items-center gap-3 px-3" style="width: 25rem; height: 7rem; overflow-x:scroll;" >
        <% @stories.each do |story| %>
            <% (0...1).each do %>    
             <%= render  story/story , story: story %>
            <% end %>
         <% end %>
     </div>




Partial for Story (_story.html.erb):
        <div class="d-flex flex-column justify-content-center align-items-center">
           <div class="col-lg-4 col-md-6 col-sm-8 p-3 mb-4 profile-post"  style="height:20rem;position: relative">
              <%= link_to @list do %> 
               <div class="row">
                 <% if list.file.attached? %>
                   <% if list.file.image? %>
               <div class="img-fluid">
                  <%= image_tag(list.file, class: "img-thumbnail rounded-circle border border-2 border-primary", style: "width: 3.5rem") %>
                </div>
                  <% elsif list.file.video? %>
                    <%= video_tag(url_for(list.file), class: "img-thumbnail rounded-circle border border-2 border-primary", style: "width: 3.5rem", autoplay: false, loop: false, muted: false, controls: true) %>
                 <% end %>
                <% end %>
             </div>
          <% end %>
        </div>
      </div>
   i was able to get the listings to display however the layout is 
    wrong it is showing the data twice - i think this is teh problem 
    <% @stories.each do |story| %>
        <% (0...1).each do %>    
          <%= render  story/story , story: story %>
            <% end %>
         <% end %>
问题回答

我看不到法典中的错误。

NameErrors refers to uninitialized constants, that is objects with Capitalized names that are available everywhere in your Rails application. Along with the NameError, you should see the file and the line where the error is being raised and uninitialized constant ConstantName.

某些固定装置在<代码>config的夹中初步形成,只有在铁路服务器启动时才会执行。 快速设置可能只是重新启用服务器。

我希望这有助于你解冻。





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签