2010-04-07 47 views
0

所以我想使用Ryan Bates的Nifty Generators的rails3分支。現在我已經使用這個寶石之前與beta1和它的工作,但升級到beta2後,我得到了一個非常粗糙的錯誤。Rails :: Generators :: Rails 3.0.0.beta2問題:: GeneratedAttribute

lib/generators/nifty/scaffold/scaffold_generator.rb:35:in `block in initialize': uninitialized constant Rails::Generators::GeneratedAttribute (NameError) 

的代碼peice的地方出現這種情況:

args_for_c_m.each do |arg| 
    if arg == '!' 
    options[:invert] = true 
    elsif arg.include?(':') 
    @model_attributes << Rails::Generators::GeneratedAttribute.new(*arg.split(':')) 
    else 
    @controller_actions << arg 
    @controller_actions << 'create' if arg == 'new' 
    @controller_actions << 'update' if arg == 'edit' 
    end 
end 

現在,我已經看到了GeneratedAttribute在許多寶石使用前,所以我爲什麼崩斷的困惑。我不確定,但我認爲這與測試版2有關。

所以我的問題是這是一個Rails的問題,在我的一端?如果它在我的頭上有什麼想法我可能做錯了?

謝謝。

回答

1

可能是beta2 bug或rails不會自動加載該模塊了。嘗試加入

require 'rails/generators/generated_attribute' 
+0

我去了rails控制檯並做了一個快速的「require'rails/generators/generated_attribute'」,它返回nil。所以我認爲這也不會起作用。 – 2010-04-07 17:48:57

+0

說得太快!有效!謝謝! – 2010-04-07 17:51:09