我的控制器中有一个哈希值,视图从中获取数据以进行显示。在我看过的教程中,我学习了如何显示哈希中的每个键、值对……但是如何只显示我想要的键、值对呢?
creating the hash in the controller
@app = {'title' => title, 'description' => description,
'active' => active, 'featured'=> featured,
'partner'=>partner
}
view: this displays each of the key,value pairs
<% @app.each do |key, value| %>
<li><%= "#{key}: #{value}" %>
<% end %>
tried this in the view just to display title, but isn't working
<% @app.select do |ind_app| %>
<strong><%= ind_app["title"] %>
<% end %>