Created
April 25, 2015 05:24
-
-
Save bagilevi/e56ba21c576df3a39f14 to your computer and use it in GitHub Desktop.
Volt calculated field
This file contains hidden or 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
| class Person < Volt::Model | |
| field :first_name | |
| field :last_name | |
| field :full_name | |
| def initialize(*args) | |
| super | |
| -> { | |
| self.full_name = [first_name, last_name].compact.join(' ') | |
| }.watch! | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment