我收到“活动中的TypeError#member - 无法将符号转换为整数”
我会说我的95%的记录工作正常,但我有一对不断绊倒这个错误。我从哪里开始研究这个问题。
以下是我正在使用的代码:
.html.erb page
<div id="listing-gallery">
<ul id="listing-slides">
<% listing.slides.each_with_index do |slide, i| %>
<%= content_tag :li, :id => "slide#{i}", :class => (i == 0) ? "active" : "" do %>
<%= image_tag slide[:large] %>
<% end %>
<% end %>
</ul>
<ul id="listing-slide-thumbs">
<% if listing.slides.count > 1 %>
<% listing.slides.each_with_index do |slide, i| %>
<%= content_tag :li, :class => (((i+1)%4 == 0) ? "last" : "") do %>
<%= content_tag :a, :href => "#slide#{i}" do %>
<span class="hover"></span>
<%= image_tag slide[:thumb] %>
<% end %>
<% end %>
<% end %>
<% end %>
</ul>
.activities_controller.rb
def member
# Assign attrs if venue exists
if @member.nil? || @member.venue.nil?
redirect_to activities_path
else
if @member.venue.attrs.count > 0
# match_by_type can be found in the ApplicationHelper
@attrs = match_by_type @member.venue.attrs
else
@attrs = nil
end
unless @member.venue.nil?
unless @member.venue.attrs.nil?
@member_rentals = @member.venue.attrs.all_by_type("Rentals")
end
end
end
end
我从哪里开始?
答案 0 :(得分:0)
请参阅<%= image_tag slide[:large] %>
和<%= image_tag slide[:thumb] %>
image
的{{1}}属性是什么?
如果slide
是image
的属性,我认为如下:
slide
或者如果使用carrierwave
<%= image_tag slide.image.url(:large) %>
顺便说一句,我在<%= image_tag slide.image_url(:large).to_s %>
listing.slides