我一直在使用一个名为ajaxful-rating的 gem 。现在,当我升级到 Rails 3.1 时,我收到以下错误:
/Users/nn/.rvm/gems/ruby-1.9.2-p290/gems/ajaxful_rating-2.2.9.1/lib/axr/model.rb:23:
syntax error, unexpected ',', expecting tASSOC (SyntaxError)
/Users/nn/.rvm/gems/ruby-1.9.2-p290/gems/ajaxful_rating-2.2.9.1/lib/axr/model.rb:27: syntax error, unexpected keyword_do_block, expecting keyword_end
options[:dimensions].each do |dimension|
原始代码在上面的链接中,但相关部分如下:
def ajaxful_rateable(options = {})
has_many :rates_without_dimension, :as => :rateable, options.merge(:class_name => 'Rate'),
:dependent => :destroy, :conditions => {:dimension => nil}
has_many :raters_without_dimension, :through => :rates_without_dimension, :source => :rater
options[:dimensions].each do |dimension|
has_many "#{dimension}_rates", :dependent => :destroy,
:conditions => {:dimension => dimension.to_s}, :class_name => 'Rate', :as => :rateable
has_many "#{dimension}_raters", :through => "#{dimension}_rates", :source => :rater
end if options[:dimensions].is_a?(Array)
是什么导致了这个问题,我该如何解决?
谢谢你。