0
私のアプリでは、私のworkouts
モデルの複数の情報カードを部分テンプレートを使ってworkouts#index
ページにレンダリングしています。すべてが完璧に動作していますが、何らかの理由で、ページの下部に生成されるカードに関する情報の奇妙なテキストバージョンがあります。Rails Partialは変数のテキストバージョンを表示します
は、ここに私のworkouts#index
ページです:だ、ここ
<div class="row container full-bg-img-003" style="min-height: 500px">
<div class="row" style="height: 125px"></div>
<% if current_user != nil && current_user.admin? %>
<div class="text-center"><%= link_to 'Create New Workout', new_workout_path, class:"waves-effect waves-light btn btn-primary" %></div>
<% end %>
<div class="row" style="height: 25px"></div>
<div class="container col-sm-6 col-sm-push-6">
<div class="card hoverable" style="padding-bottom: 20px; padding-top: 10px; margin-bottom: 50px; background-color: rgba(255, 255, 255, .85)">
<div class="container col-sm-12">
<h4 class="text-center">This is it.</h4>
<p class="text-center">You've found your way to the inner sanctum of the BurnIt universe. Here lie all the workouts we have to offer. Use them wisely, young grasshopper.</p>
</div> <!-- container inside -->
</div> <!-- card panel end -->
</div> <!-- column container -->
<div class="row" style="height: 125px"> </div>
</div> <!-- row -->
<!--Section: Detailed info-->
<section id="sec-details"><div class="container">
<div class="row">
<h2 class="text-center">Workouts Database</h2><hr>
<!--Image Cards Go Here-->
<%= @workouts.each do |w| %>
<%= render "workouts/template", workout: w %>
<% end %>
<!--Image Cards End Here-->
</div> <!-- row -->
</div> <!-- container --></section>
そして、私の_template.html.erb
部分:
<div class="container col-sm-6 col-md-4">
<div class="card hoverable">
<div class="card-image">
<div class="view overlay hm-white-slight z-depth-1">
<%#= link_to workout.workout_img class: "img-responsive" alt: "" %>
<div class="mask waves-effect"></div>
</div>
<h5 class="text-center" style="padding-top: 15px"><%= workout.name %></h5>
</div>
<div class="card-content">
<iframe width="100%" height="200" src="https://www.youtube.com/embed/<%= workout.video %>?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
<div style="height: 200px">
<p><strong>Goal: </strong><%= workout.teaser %></p>
<p><strong>Description: </strong><%= workout.description %></p>
<p><strong>Workout Difficulty Level: </strong><%= workout.difficulty %></p>
</div>
</div>
<div class="card-action">
<%= link_to 'Do this one!', workout_path(workout), class: "red-text" %>
</div>
</div>
</div>
:
[#<Workout id: 1, name: "Abs 0002", workout_type: "Abs", teaser: "Abdominal pain begins here...", description: "Since there is no Abs 0001, we begin here. 15 min...", video: "uw9M6VhfW0A", difficulty: 3, trainer: nil, user_id: nil, created_at: "2016-05-17 05:46:46", updated_at: "2016-05-17 05:51:36">, #<Workout id: 2, name: "Abs 0003", workout_type: "Abs", teaser: "Want more abs? You got 'em.", description: "15 minutes, not enough breaks, but hey...there are...", video: "dcEJP2MPvrM", difficulty: 3, trainer: nil, user_id: nil, created_at: "2016-05-18 00:53:14", updated_at: "2016-05-18 00:53:14">, #<Workout id: 3, name: "Abs 0004", workout_type: "Abs", teaser: "", description: "", video: "hTZwbP_lsRk", difficulty: nil, trainer: nil, user_id: nil, created_at: "2016-05-18 01:01:19", updated_at: "2016-05-18 01:01:19">, #<Workout id: 4, name: "Abs 0005", workout_type: "Abs", teaser: "", description: "", video: "2KrzvpHOYwo", difficulty: nil, trainer: nil, user_id: nil, created_at: "2016-05-18 01:01:48", updated_at: "2016-05-18 01:01:48">, #<Workout id: 5, name: "Abs 0006", workout_type: "Abs", teaser: "", description: "", video: "IMwDUfTQ14M", difficulty: nil, trainer: nil, user_id: nil, created_at: "2016-05-18 01:02:15", updated_at: "2016-05-18 01:02:15">, #<Workout id: 6, name: "Abs 0007", workout_type: "Abs", teaser: "", description: "", video: "VLw2gIZdsJE", difficulty: nil, trainer: nil, user_id: nil, created_at: "2016-05-18 01:02:40", updated_at: "2016-05-18 01:02:40">, #<Workout id: 7, name: "Abs 0008", workout_type: "Abs", teaser: "", description: "", video: "PADrEPDBhEA", difficulty: nil, trainer: nil, user_id: nil, created_at: "2016-05-18 01:05:37", updated_at: "2016-05-18 01:05:37">, #<Workout id: 8, name: "Abs 0009", workout_type: "Abs", teaser: "", description: "", video: "qDYnqdv160Y", difficulty: nil, trainer: nil, user_id: nil, created_at: "2016-05-18 01:06:00", updated_at: "2016-05-18 01:06:00">]
誰でもこのランダムなテxtはどこから来ていますか?
Argh!ありがとうございました!それが私を夢中にさせていた。 – Liz
問題はありません、私たちの最善を尽くす:)私の答えを受け入れることができるように、それはあなたの質問に答えたようにマークしますか? – Jarrel09
待ち時間47秒... – Liz