Skip to content

Instantly share code, notes, and snippets.

@bagilevi
Created April 25, 2015 05:24
Show Gist options
  • Select an option

  • Save bagilevi/e56ba21c576df3a39f14 to your computer and use it in GitHub Desktop.

Select an option

Save bagilevi/e56ba21c576df3a39f14 to your computer and use it in GitHub Desktop.
Volt calculated field
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