6828


[Rails tutorial](http://railstutorial.jp/chapters/a-demo-app?version=4.0#sec-
demo_users_resource) で `rails generate scaffold User name:string email:string`
をたたくとエラーがでて困っています。

エラーログ：

[code]

    C:\dev\rails_projects\demo_app>rails generate scaffold User name:string email:string
    DL is deprecated, please use Fiddle invoke  active_record
    C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.5/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `raise_in_transactional_callbacks=' for #<Class:0x39d5d98> (NoMethodError)
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.5/lib/active_record/railtie.rb:166:in `block (3 levels) in <class:Railtie>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.5/lib/active_record/railtie.rb:165:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.5/lib/active_record/railtie.rb:165:in `block (2 levels) in <class:Railtie>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/lazy_load_hooks.rb:44:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.5/lib/active_record/base.rb:322:in `<module:ActiveRecord>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.5/lib/active_record/base.rb:22:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/generators/named_base.rb:172:in `pluralize_table_names?'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/generators/named_base.rb:112:in `table_name'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.5/lib/rails/generators/active_record/model/model_generator.rb:18:in `create_migration_file'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/group.rb:277:in `block in _invoke_for_class_method'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/shell.rb:68:in `with_padding'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/group.rb:266:in `_invoke_for_class_method'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/group.rb:133:in `_invoke_from_option_orm'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/generators.rb:156:in `invoke'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/commands/generate.rb:11:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/commands.rb:48:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
    
[/code]


CC BY-SA 3.0
2015-02-20T02:16:39.100
6809
2015-07-20T11:53:45.127
2015-07-20T11:53:45.127
8000
8420
question
ruby-on-rails
Scaffold作成時に「`method_missing': undefined method `raise_in_transactional_callbacks='」というエラーが発生します


「undefined method
`raise_in_transactional_callbacks='」というキーワードでググったらいくつかそれらしき情報が見つかりました。

`config/application.rb` に以下の行があったら削除すると良いみたいです。

[code]

    config.active_record.raise_in_transactional_callbacks = true
    
[/code]

試してみてください。

参考: <https://stackoverflow.com/questions/28006358/undefined-method-raise-in-
transactional-callbacks-for-activerecordbaseclass>


CC BY-SA 3.0
2015-02-20T06:48:18.480
6828
2015-02-20T06:48:18.480
2017-05-23T12:38:56.083
-1
85
6809
answer