Class: ActiveRecord::Temporal::ApplicationVersioning::ApplicationVersioned::Original

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord/temporal/application_versioning/application_versioned.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, time, **options) ⇒ Original

Returns a new instance of Original.



66
67
68
69
70
# File 'lib/activerecord/temporal/application_versioning/application_versioned.rb', line 66

def initialize(klass, time, **options)
  @klass = klass
  @time = time
  @options = options
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



64
65
66
# File 'lib/activerecord/temporal/application_versioning/application_versioned.rb', line 64

def klass
  @klass
end

#optionsObject (readonly)

Returns the value of attribute options.



64
65
66
# File 'lib/activerecord/temporal/application_versioning/application_versioned.rb', line 64

def options
  @options
end

#timeObject (readonly)

Returns the value of attribute time.



64
65
66
# File 'lib/activerecord/temporal/application_versioning/application_versioned.rb', line 64

def time
  @time
end

Instance Method Details

#with(attributes) ⇒ Object



72
73
74
75
76
77
78
79
# File 'lib/activerecord/temporal/application_versioning/application_versioned.rb', line 72

def with(attributes)
  new_record = klass.new(attributes)
  new_record.set_time_dimension_start(time)

  new_record.save if options[:save]

  new_record
end