Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 为什么会在页面的最后显示参数?_Ruby On Rails 4_Parameters_Hashmap - Fatal编程技术网

Ruby on rails 4 为什么会在页面的最后显示参数?

Ruby on rails 4 为什么会在页面的最后显示参数?,ruby-on-rails-4,parameters,hashmap,Ruby On Rails 4,Parameters,Hashmap,我正在做一系列议程音乐会,index.html.erb在页面的最后显示了@agents的参数。 决赛中显示的参数: [#<Agenda id: 12, title: "test to show the past shows", info: "testando se aparece shows passados!", date_concert: "2015-05-13", begin_time: "2000-01-01 21:11:00", end_time: "2000-01-01 00:

我正在做一系列议程音乐会,index.html.erb在页面的最后显示了@agents的参数。 决赛中显示的参数:

[#<Agenda id: 12, title: "test to show the past shows", info: "testando se aparece shows passados!", date_concert: "2015-05-13", begin_time: "2000-01-01 21:11:00", end_time: "2000-01-01 00:11:00", created_at: "2015-07-20 23:13:05", updated_at: "2015-07-20 23:13:05", user_id: nil>, #<Agenda id: 8, title: "Festival MPB Goiânia, Brasil", info: "Festival de Música Popular Brasileira em Goiânia, ...", date_concert: "2015-07-20", begin_time: "2000-01-01 00:43:00", end_time: "2000-01-01 22:40:00", created_at: "2015-07-20 22:43:17", updated_at: "2015-07-20 22:43:17", user_id: nil>, #<Agenda id: 9, title: "Mota Live Project at Disco Bataplan.", info: "Mota Live Project at Disco Bataplan. \r\nIn the Fest...", date_concert: "2015-07-20", begin_time: "2000-01-01 00:03:00", end_time: "2000-01-01 01:10:00", created_at: "2015-07-20 22:46:23", updated_at: "2015-07-20 22:46:23", user_id: nil>, #<Agenda id: 1, title: "Heineken Jazz Festival - Donostia", info: "Heineken Jazz Festival in Donostia-San Sebastian w...", date_concert: "2015-07-23", begin_time: "2000-01-01 20:30:00", end_time: "2000-01-01 00:00:00", created_at: "2015-07-19 22:06:01", updated_at: "2015-07-20 16:54:19", user_id: 3>, #<Agenda id: 13, title: "OAHspkdbasbd", info: "sdfñsdñf", date_concert: "2015-07-24", begin_time: "2000-01-01 12:27:00", end_time: "2000-01-01 14:55:00", created_at: "2015-07-21 00:28:05", updated_at: "2015-07-21 00:28:05", user_id: nil>, #<Agenda id: 10, title: "Show teste", info: "Show teste, sample!", date_concert: "2015-07-27", begin_time: "2000-01-01 23:00:00", end_time: "2000-01-01 01:00:00", created_at: "2015-07-20 22:54:23", updated_at: "2015-07-20 22:58:31", user_id: nil>, #<Agenda id: 5, title: "Show Brasil Skol Event", info: "Concert with a Event SKol Beer", date_concert: "2015-08-02", begin_time: "2000-01-01 10:40:00", end_time: "2000-01-01 13:00:00", created_at: "2015-07-20 16:56:30", updated_at: "2015-07-20 16:56:30", user_id: nil>, #<Agenda id: 2, title: "Mota Project Live - Disco Gu", info: "Concierto del grupo Mota Project Live en la Disco ...", date_concert: "2015-08-03", begin_time: "2000-01-01 21:00:00", end_time: "2000-01-01 00:00:00", created_at: "2015-07-19 23:49:56", updated_at: "2015-07-20 16:53:07", user_id: 3>, #<Agenda id: 6, title: "BBK - Bilbao Live", info: "Concierto en el BBK Live!", date_concert: "2015-08-07", begin_time: "2000-01-01 19:00:00", end_time: "2000-01-01 20:00:00", created_at: "2015-07-20 17:01:14", updated_at: "2015-07-20 17:01:14", user_id: nil>, #<Agenda id: 7, title: "Show Donosti Indie Festival", info: "Festival Indie en la ciudad de Donosti-San Sebasti...", date_concert: "2015-08-09", begin_time: "2000-01-01 22:30:00", end_time: "2000-01-01 23:40:00", created_at: "2015-07-20 22:36:11", updated_at: "2015-07-20 22:36:11", user_id: nil>]
你想要而不是

并且都可以包含ruby语句。第一个选项将显示ruby语句返回的内容,后一个选项告诉视图不要显示ruby代码返回的内容。调用@agents.each返回议程数组,但您不想显示它,因此请使用所需的破折号选项,而不是

并且都可以包含ruby语句。第一个选项将显示ruby语句返回的内容,后一个选项告诉视图不要显示ruby代码返回的内容。调用@agents.each返回议程数组,但您不想显示它,因此请使用破折号选项

您在此之间编写的代码将显示在UI中,其中

<%  ...... %> 
您在此之间编写的代码不会显示在UI中

试试这个,会有用的

 <p id="notice"><%= notice %></p>
 <div class="distance">
 <div class="container">
 <div class="row">


 <div class="agenda_concerts">
  <h1> Agenda Concerts </h1>
  <hr class="featurette-divider">

      <% @agendas.each do |agenda| %>

        <% if agenda.date_concert.past? %>

        <% else %>
          <span class="title"><%= link_to agenda.title, agenda %></span>
          </br>
          <span class="info"><%= agenda.info %></span>
          </br>
          <span class="date">Date: <%= agenda.date_concert.to_formatted_s(:rfc822)  %></span>
          </br>
          <span class="begin_time">Begin: <%= agenda.begin_time.to_s(:time) %></span>
          </br>
          <span class="end_time">End: <%= agenda.end_time.to_s(:time) %></span>
          </br>
          <% if user_signed_in? %>
            <%= link_to 'Edit', edit_agenda_path(agenda) %></td>
            <%= link_to 'Destroy', agenda, method: :delete, data: { confirm: 'Are you sure?' } %></td>
          <% end %>
          <hr class="featurette-divider">
        <% end %>
      <% end %>
   </div>
  </div>
  </div>
  </div>
希望对你有帮助

您在此之间编写的代码将显示在UI中,其中

<%  ...... %> 
您在此之间编写的代码不会显示在UI中

试试这个,会有用的

 <p id="notice"><%= notice %></p>
 <div class="distance">
 <div class="container">
 <div class="row">


 <div class="agenda_concerts">
  <h1> Agenda Concerts </h1>
  <hr class="featurette-divider">

      <% @agendas.each do |agenda| %>

        <% if agenda.date_concert.past? %>

        <% else %>
          <span class="title"><%= link_to agenda.title, agenda %></span>
          </br>
          <span class="info"><%= agenda.info %></span>
          </br>
          <span class="date">Date: <%= agenda.date_concert.to_formatted_s(:rfc822)  %></span>
          </br>
          <span class="begin_time">Begin: <%= agenda.begin_time.to_s(:time) %></span>
          </br>
          <span class="end_time">End: <%= agenda.end_time.to_s(:time) %></span>
          </br>
          <% if user_signed_in? %>
            <%= link_to 'Edit', edit_agenda_path(agenda) %></td>
            <%= link_to 'Destroy', agenda, method: :delete, data: { confirm: 'Are you sure?' } %></td>
          <% end %>
          <hr class="featurette-divider">
        <% end %>
      <% end %>
   </div>
  </div>
  </div>
  </div>
希望对你有帮助

 <p id="notice"><%= notice %></p>
 <div class="distance">
 <div class="container">
 <div class="row">


 <div class="agenda_concerts">
  <h1> Agenda Concerts </h1>
  <hr class="featurette-divider">

      <% @agendas.each do |agenda| %>

        <% if agenda.date_concert.past? %>

        <% else %>
          <span class="title"><%= link_to agenda.title, agenda %></span>
          </br>
          <span class="info"><%= agenda.info %></span>
          </br>
          <span class="date">Date: <%= agenda.date_concert.to_formatted_s(:rfc822)  %></span>
          </br>
          <span class="begin_time">Begin: <%= agenda.begin_time.to_s(:time) %></span>
          </br>
          <span class="end_time">End: <%= agenda.end_time.to_s(:time) %></span>
          </br>
          <% if user_signed_in? %>
            <%= link_to 'Edit', edit_agenda_path(agenda) %></td>
            <%= link_to 'Destroy', agenda, method: :delete, data: { confirm: 'Are you sure?' } %></td>
          <% end %>
          <hr class="featurette-divider">
        <% end %>
      <% end %>
   </div>
  </div>
  </div>
  </div>