Stringify键错误

时间:2013-10-08 22:00:26

标签: ruby arrays activerecord methods hash

这是我的方法:

  def self.unique_coasters_this_year(year)
    counter = 0
    all.each do |c|
      years = new Array
      c.rode_on.each do |date, count|
        years << (Date.parse date).year
      end
      if years.include?(year)
        counter += 1
      end
    end
    counter
  end

运行时我得到这个stringify_keys错误:

  

oMethodError:未定义的方法stringify_keys' for Array:Class from /Users/user/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/activerecord-3.2.12/lib/active_record/attribute_assignment.rb:69:in assign_attributes'[97] pry(main)&gt;

知道出了什么问题吗?

0 个答案:

没有答案