Does dependency injection exist in Rails?

Viewed 26420

Does the fact that Rails have an MVC approach mean that is has dependency injection?

Or is there a reason that we don't talk about dependency injection in Rails?

If Rails does have dependency injection, what does it consist of?

5 Answers

Dependency Injection is a paradigm, so it exists in every object-oriented language.

Whether there are DI frameworks for Ruby - check this question

Dependency injection is usually unnecessary with Ruby. Jamis Buck blogged extensively about the reasons why. Well worth a read.

I'd say that you don't need such a thing with ruby... but if you really want to, some people have workarounds.

Related