Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I store my Rails 3 observers in the app/models directory?

or do they belong in their own place?

like image 753
AKWF Avatar asked Feb 08 '11 18:02

AKWF


2 Answers

I agree with the convention, but when you find you've got a lot of observers in app/models, you might want to go ahead and store all your observers in app/observers. (There are also some gems to help streamline your design).

Just remember to add app/observers to your app's configured load path.

like image 175
ybakos Avatar answered Jan 04 '23 13:01

ybakos


If you generate one (e.g., "rails g observer Test") that's where it goes, so I'd stick with the convention.

like image 29
TK-421 Avatar answered Jan 04 '23 13:01

TK-421