app/models/run.rb
# convert entity id notation to id and model name 
convert entity id notation to id and model name
convert entity id notation to id and model name
def to_id_and_model
    id, model_name = self.to_id_and_model_name
    id  or fail ArgumentError, "#{self.inspect} has no id as entity_id."
    id =  id.start_with?("new") ? id : (id.to_i > 0 ? id.to_i : fail(ArgumentError, "#{self.inspect} is illegal as entity_id.") )
    model = (model_name.blank? ? nil : model_name.to_model)
    return id, model
  end
def to_id_and_model id , model_name = self . to_id_and_model_name id or fail ArgumentError , "#{self.inspect} has no id as entity_id." id = id . start_with? ( "new" ) ? id : ( id . to_i > 0 ? id . to_i : fail ( ArgumentError , "#{self.inspect} is illegal as entity_id." ) ) model = ( model_name . blank? ? nil : model_name . to_model ) return id , model end
convert entity id notation to id and model name
convert entity id notation to id and model name