lib/hungry/menu.rb in hungry-0.1.5 vs lib/hungry/menu.rb in hungry-0.2.0

- old
+ new

@@ -22,11 +22,11 @@ :created_at, :updated_at lazy_load :venue def managed? - type == 'managed' || categories.present? + type == 'managed' || (!download? && categories.present?) end def download? type == 'download' end @@ -44,9 +44,16 @@ @categories = new_categories.map do |attributes| category = Menu::Category.new(attributes) category.menu = self category.data_source = data_source category + end + end + + %w[created_at updated_at].each do |method| + define_method("#{method}=") do |new_value| + parsed_value = new_value.present? ? Time.parse(new_value) : nil + instance_variable_set("@#{method}", parsed_value) end end end end