app/models/macro_step.rb
# Convert this step into a valid #Record
Convert this step into a valid #Record
Convert this step into a valid #Record
def build( domain = nil )
    record_class = self.record_type.constantize
    attrs = self.attributes.dup
    attrs.delete_if { |k,_| !record_class.columns.map(&:name).include?( k ) }
    attrs.delete('id')
    unless domain.nil?
      attrs.keys.each do |k|
        attrs[k] = attrs[k].gsub( '%ZONE%', domain.name ) if attrs[k].is_a?( String )
      end
    end
    record_class.new( attrs )
  end
def build ( domain = nil ) record_class = self . record_type . constantize attrs = self . attributes . dup attrs . delete_if { | k , _ | ! record_class . columns . map ( & :name ) . include? ( k ) } attrs . delete ( 'id' ) unless domain . nil? attrs . keys . each do | k | attrs [ k ] = attrs [ k ] . gsub ( '%ZONE%' , domain . name ) if attrs [ k ] . is_a? ( String ) end end record_class . new ( attrs ) end
Convert this step into a valid #Record
Convert this step into a valid #Record
# make a clean copy of ourself # parse each attribute for %ZONE%
domain
<not_specific>