Re:On logic in a Rails app
by aurelianito on Tuesday December 25, 2012 @09:48AM
(#4966076)
I am just pointing out that refactoring the code he proposed, removing duplicate code, we arrive again at the Rails controller he does not like.
I see duplicate code all over this "service based architecture".
Re:On logic in a Rails app
by gavingmiller on Tuesday December 25, 2012 @12:12PM
(#4966412)
I mostly agree, with the exception of the initializer, something I haven't seen put to much use in controllers. The main thrust of my question was, do you have any links/examples for a DI based rails controller? Other than your "in theory" refactoring?
Re:On logic in a Rails app
by aurelianito on Saturday December 29, 2012 @09:01AM
(#4982082)
I do have examples of similar things but I cannot disclose the code as it was written in closed applications. For instance, I am guilty of redoing poorly the java servlet API using servlets.
In my experience DI has been a great pattern for writing testable code, so do you have any resources relevant to DI in Rails, and why it (DI) is more beneficial than the OPs argument of a Service based architecture? (other than a simple google search like I did?)