blog/themes/hugo-classic/exampleSite/content/post/2012-01-23-juicy-code.md
2018-05-21 13:21:26 +02:00

511 B

title author date categories tags slug
Juicy Code Open Source 2012-01-23
Code
Juicy
juicy-code

Check out this JUICY! code:

def with_value_from_database(value)
  self.class.from_database(name, value, type)
end

def with_cast_value(value)
  self.class.with_cast_value(name, value, type)
end

def with_type(type)
  if changed_in_place?
    with_value_from_user(value).with_type(type)
  else
    self.class.new(name, value_before_type_cast, type, original_attribute)
  end
end