Sha256: 309c0f0cd86af8f3006d80152e8d33113f4f228a12102201ff37e89c82ea5bcb
Contents?: true
Size: 970 Bytes
Versions: 9
Compression:
Stored size: 970 Bytes
Contents
# frozen_string_literal: true module Timely module Extensions # Add a WeekDays attribute # # By default it will use attribute_bit_array as db field, but this can # be overridden by specifying :db_field => 'somthing_else' def weekdays_field(attribute, options = {}) db_field = options[:db_field] || attribute.to_s + '_bit_array' composed_of(attribute, class_name: '::Timely::WeekDays', mapping: [[db_field, 'weekdays_int']], converter: proc { |field| ::Timely::WeekDays.new(field) }) end def acts_as_seasonal belongs_to :season, class_name: 'Timely::Season', optional: true accepts_nested_attributes_for :season validates_associated :season before_save do |object| next unless object.season object.boundary_start = object.season.boundary_start object.boundary_end = object.season.boundary_end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems