Created
December 17, 2015 18:08
-
-
Save dchandekstark/af09e091c71d6bfaa593 to your computer and use it in GitHub Desktop.
Virtus model example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "virtus" | |
# BEFORE | |
class Filter | |
attr_accessor :clauses | |
def initialize(clauses = nil) | |
@clauses = Array(clauses) | |
end | |
end | |
# AFTER | |
class Filter | |
include Virtus.model | |
attribute :clauses, Array, default: [ ] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment