Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introducing Mutator Layer in Rails

Introducing Mutator Layer in Rails

A new layer to cleaning up model and controllers in rails.

Philip Lambok

April 16, 2019
Tweet

More Decks by Philip Lambok

Other Decks in Programming

Transcript

  1. Rules • Service (High Level Application Logic) Ketika logic memuat

    lebih dari satu model! → Ketika • Mutator (Low Level Application Logic) – Aplication Logic yang memuat satu model saja! • before_create = UserMutator.create(user) • before_destroy = UserMutator.destroy(user) • before_save = UserMutator.save(user) • ...