我刚刚将应用程序 Rails 版本从 3.0.9 升级到 3.1.2,并且还从 ruby 1.8.7 切换到了 1.9.2。
在更新后尝试运行服务器时,我收到以下错误消息:
rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:65:in `directory': wrong number of arguments (0 for 1) (ArgumentError)
from /Users/Big_Bird/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:165:in `directory'
from /Users/Big_Bird/apps/Example/vendor/plugins/calendar_date_select/init.rb:12:in `block (2 levels) in <class:Plugin>'
from /Users/Big_Bird/apps/Example/vendor/plugins/calendar_date_select/init.rb:11:in `each'
from /Users/Big_Bird/apps/Example/vendor/plugins/calendar_date_select/init.rb:11:in `block in <class:Plugin>'
现在插件发生错误的片段是:
%w[calendar_date_select includes_helper].each { |file|
require File.join( File.dirname(__FILE__), "lib",file)
}
ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelper)
ActionView::Base.send(:include, CalendarDateSelect::FormHelper)
ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)
# install files
unless File.exists?(Rails.root + '/public/javascripts/calendar_date_select/calendar_date_select.js')
['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
source = File.join(directory,dir)
dest = Rails.root + dir
FileUtils.mkdir_p(dest)
FileUtils.cp(Dir.glob(source+'/*.*'), dest)
end
end
我不太确定问题出在哪里,因为插件中列出的所有目录都是正确的,升级时我不得不从使用 RAILS_ROOT 切换到 Rails.root ,但仅此而已。
我将不胜感激有关如何解决此问题的任何指导。