在撰写这个问题之前,我查看了这些答案,但是无法找到解决方案:
当执行rails generate scaffold User name:string email:string时出现错误。
rake中止!ActiveRecord::Base:Class没有定义'migration_error='方法。
启动Rails服务器时出现错误:未定义'configure'方法。
当我尝试启动一个新的应用程序(Hartl's tutorial,第2章),在阶段scaffold开始时,我收到了以下错误信息:
**undefined method `configure' for #<SampleApp2::Application:0x00000101a74610> (NoMethodError)**
感谢上述示例,我编辑了development.rb文件:
DemoApp::Application.configure do
我把我的应用程序叫做demo_app,所以我改变了它的名称。
之后,我尝试再次运行scaffold,但是出现了一个新的错误:
**method_missing': undefined method raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)**
作为回应类似情况,建议使用一种迁移方法 - 将其从文件 development.rb 中删除。同样,我试图在该文件中查找 raise_in_transactional_callbacks 方法,但它并不存在!此外,我想说的是,在 cmd 中生成的完整代码非常庞大。
C:\Sites\demo_app>rails generate scaffold User name:string email:string
invoke active_record
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/railtie.rb:166:in `block (3 levels) in <class:Railtie>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/railtie.rb:165:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/railtie.rb:165:in `block (2 levels) in <class:Railtie>'
…
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands.rb:48:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
我希望你能帮忙翻译以下内容:在哪里...(省略号) - 特别剪裁类似的代码。 就这些。非常感谢您的帮助!
rails app:update
呦 ;) - Tashows