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