Sha256: f7d7d980a2a6fbd885052c45cc88135b880f7d045f0220263fbf59d4dff66c3b

Contents?: true

Size: 352 Bytes

Versions: 6

Compression:

Stored size: 352 Bytes

Contents

class MyModel < Mimi::DB::Model
  field :id, as: :integer, primary_key: true, not_null: true, auto_increment: true

  field :name, as: :string, limit: 64
  field :code, as: :blob, default: -> { random_code }
  field :value, as: :decimal, precision: 10, scale: 3

  index :name

  def self.random_code
    SecureRandom.hex(16)
  end
end # class MyModel

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mimi-db-0.3.5 examples/my_model.rb
mimi-db-0.3.4 examples/my_model.rb
mimi-db-0.3.3 examples/my_model.rb
mimi-db-0.3.2 examples/my_model.rb
mimi-db-0.3.1 examples/my_model.rb
mimi-db-0.3.0 examples/my_model.rb