-2

我收到“活动中的类型错误#member - 无法将符号转换为整数”

我会说我 95% 的记录都可以正常工作,但我有几个一直在触发这个错误。我从哪里开始看这个问题。

这是我正在使用的代码:

.html.erb 页面

<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

我从这里去哪里?

4

1 回答 1

0

<%= image_tag slide[:large] %><%= image_tag slide[:thumb] %>

什么image属性slide

如果image是属性slide,我认为例如:

<%= image_tag slide.image.url(:large) %>

或者如果使用载波

<%= image_tag slide.image_url(:large).to_s %>

顺便说一下,我没有listing.slides看到action member

于 2013-05-16T00:41:41.110 回答