5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails4に移行した時concerned_withで、はまったこと

Posted at

以下のようにconcerned_withパターンを使用していていると

model/hoge
class Foo < ActiveRecord::Base
	concerned_with :bar

	has_many :bars
end

Rails4.1で動かそうとすると、以下のエラーになるので、

RuntimeError: Circular dependency detected while autoloading constant Foo::Bar

user/bar.rb を user/bar_status.rbに改名し、以下のようにソースを修正したところ、エラーは解消した。

model/hoge
class Foo < ActiveRecord::Base
	concerned_with :bar_status

	has_many :bars
end
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?