Business Layer Pattern on Rails? MVCL

Posted by Fabiano PS on Stack Overflow See other posts from Stack Overflow or by Fabiano PS
Published on 2010-03-12T20:24:03Z Indexed on 2010/03/12 20:27 UTC
Read the original article Hit count: 447

That is a broad question, and I appreciate no short/dumb asnwers like: "Oh that is the model job, this quest is retarded (period)"

PROBLEM Where I work at people created a system over 2 years for managing the manufacture process over demand in the most simplified still broad as possible, involving selling, buying, assemble, The system is coded over Ruby On Rails.

The result has been changed lots of times and the result is a mess on callbacks (some are called several times), 200+ models, and fat controllers: Total bad.

The QUESTION is, if there is a gem, or pattern designed to handle Rails large app logic? The logic whould be able to fully talk to models (whose only concern would be data format handling and validation)

What I EXPECT is to reduce complexity from various controllers, and hard to track callbacks into files with the responsibility to handle a business operation logic. In some cases there is the need to wait for a response, in others, only validation of the input is enough and a bg process would take place.

ie:
--> Sell some products (need to wait the operation to finish)
1. Set a View able to get the products input
2. Controller gets the product list inputed by employee and call the logic

Logic::ExecuteWithResponse('sell', 'products', :prods => @product_list_with_qtt, :when => @date, :employee => current_user()  )  

This Logic would handle buying order, assemble order, machine schedule, warehouse reservation, and others

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about design-patterns