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

Virtus Lightning Talk

Virtus Lightning Talk

A lightning talk about the Virtus gem. https://github.com/solnic/virtus

Samson Ootoovak

April 29, 2014
Tweet

More Decks by Samson Ootoovak

Other Decks in Programming

Transcript

  1. THIS MEANS YOU CAN USE RAILS FORM NICETIES WITHOUT FEELING

    LIKE EVERY MODEL WITH A FORM HAS TO BE AN ACTIVERECORD MODEL.
  2. ADDING VIRTUS ON TOP OF THAT MAKES IT EASIER TO

    INSURE YOUR DATA IS SANITISED.
  3. c l a s s U s e r P

    h o n e i n c l u d e V i r t u s . m o d e l i n c l u d e A c t i v e M o d e l : : M o d e l a t t r i b u t e : n a m e , S t r i n g a t t r i b u t e : p h o n e _ t y p e , S t r i n g a t t r i b u t e : p h o n e _ n u m b e r , I n t e g e r v a l i d a t e s _ p r e s e n c e _ o f : n a m e d e f p e r s i s t e d ? ; f a l s e ; e n d d e f s a v e ; v a l i d ? ; e n d e n d
  4. c l a s s U s e r P

    h o n e i n c l u d e V i r t u s . m o d e l i n c l u d e A c t i v e M o d e l : : M o d e l a t t r i b u t e : n a m e , S t r i n g a t t r i b u t e : p h o n e _ t y p e , P h o n e T y p e a t t r i b u t e : p h o n e _ n u m b e r , P h o n e N u m b e r v a l i d a t e s _ p r e s e n c e _ o f : n a m e d e f p e r s i s t e d ? ; f a l s e ; e n d d e f s a v e ; v a l i d ? ; e n d e n d
  5. c l a s s G e o L o

    c a t i o n i n c l u d e V i r t u s . v a l u e _ o b j e c t v a l u e s d o a t t r i b u t e : l a t i t u d e a t t r i b u t e : l o n g i t u d e e n d e n d