0

だから私はライアンベイツによるニフティジェネレーターのrails3ブランチを使おうとしています。以前、このgemをbeta1で使用して機能しましたが、beta2にアップグレードした後、非常に奇妙なエラーが発生しました。

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

これが発生するコードの一部:

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

これまで多くのgemでGeneratedAttributeが使用されているのを見たことがあるので、なぜそれが壊れているのか混乱しています。よくわかりませんが、これはbeta2に関係していると思います。

だから私の質問は、これは私の側の何かのRailsの問題ですか?それが私の側にある場合、私が間違ったことをしたかもしれないアイデアはありますか?

ありがとうございました。

4

1 に答える 1

1

おそらく、beta2のバグかRailsのどちらかが、そのモジュールを自動的にロードしなくなります。追加してみてください

require 'rails/generators/generated_attribute'
于 2010-04-07T17:38:21.407 に答える