小编Sac*_*hin的帖子

参数错误提供了零个位置。无法使用载波Ruby on Rails为image_tag构建URI

使用image_tag时,提供的Nil位置出现参数错误。如何使image_tag仅在存在相应图像时才显示的位置为可选?这是与Ruby on Rails 5一起使用的。

这是我当前的显示页面视图:

<p id="notice"><%= notice %></p>

<%= image_tag @restaurant.image_url %>

<p>
  <strong>Name:</strong>
  <%= @restaurant.name %>
</p>

<p>
  <strong>Address:</strong>
  <%= @restaurant.address %>
</p>

<p>
  <strong>Phone:</strong>
  <%= @restaurant.phone %>
</p>

<p>
  <strong>Website:</strong>
  <%= @restaurant.website %>
</p>

<%= link_to 'Edit', edit_restaurant_path(@restaurant), class: 'btn btn-link' %> |
<%= link_to 'Back', restaurants_path, class: 'btn btn-link' %>
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails ruby-on-rails-5

4
推荐指数
1
解决办法
2223
查看次数

黄瓜 4 可选单词?

@Then("a topic is (not) displayed on the chat icon of the menu")
Run Code Online (Sandbox Code Playgroud)

基本上我希望如果可能的话不要是可选的?以前是(是|不是)。

添加 is|is not 是捕获组的一部分,在 stepdef 中作为字符串输入。

java selenium cucumber-java

0
推荐指数
1
解决办法
2340
查看次数