Rails Best Practices 2: Move logic to model

Logo devnterface d88f51727b3053dd3115e1ef9c566ad79b4c2edb3cd208c06345fc37058bebd9

Today we continue our analysis of the Rails Best Practices. In the previous post we saw Named Scope, Model Association and Following the same direction, in today’s post we’ll examine the use of Callback Model and Virtual Attribute.1. Virtual AttributeSuppose we have a customers list table defined as follows123456create_table "clients", :force => true do |t| t.string "first_name" t.string "las...

Read more