Sha256: 4a47b9d6e5eccea6a55ed4bf82c6e0ef3b362ff8a11cce9bb66a644859672eca

Contents?: true

Size: 645 Bytes

Versions: 2

Compression:

Stored size: 645 Bytes

Contents

# ** What is a Model? **
#
# "Model" will help you to store any information in database and sync this information with server.

# ** Create a model. **
#
# Just inherit it from `Prime::Model`.

class Event < Prime::Model
end

# ** Add some attributes to model. **
#
# E.g. we want event to have title and description.

class Event < Prime::Model
  attribute :title
  attribute :description
end

# ** Create some item. **
#
# This event will be saved to database and accessible after restart of application.

event = Event.create(
  title: 'MotionPrime release.',
  description: 'Check out new features.'
)

# ** Retrieve all events **

Event.all

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
motion-prime-0.6.0 doc/code/models.rb
motion-prime-0.5.7 doc/code/models.rb