Sha256: 2256b4dd0de4c374d298ea47362677e981666b4b70f2eb93fd0b9005b734d215

Contents?: true

Size: 751 Bytes

Versions: 2

Compression:

Stored size: 751 Bytes

Contents

module BaseModels

  class Person
    include CleanModel::Base

    attribute :first_name
    attribute :last_name

    validates_presence_of :first_name, :last_name
  end

  class Engine
    include CleanModel::Base

    attribute :power, class_name: :numeric
    attribute :cylinders, class_name: :integer
    attribute :valves, class_name: 'Integer'
  end

  class Car
    include CleanModel::Base

    attribute :brand
    attribute :model
    attribute :engine, class_name: 'BaseModels::Engine'
    attribute :comfort, transformation: lambda { |v| v.is_a?(String) ? v.split(',').map(&:strip) : v }
  end

  class Factory
    include CleanModel::Base

    attribute :cars, collection: 'BaseModels::Car'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clean_model-0.0.2 spec/support/models/base_models.rb
clean_model-0.0.1 spec/support/models/base_models.rb