-
Notifications
You must be signed in to change notification settings - Fork 75
Models
Pedro Belo edited this page Jul 10, 2015
·
5 revisions
Pliny models are just like Rails', only using Sequel::Model instead of ActiveRecord. Use them to wrap access to database.
You should try keep models lean. Think of them as pure data objects: every single method in a model should only return data that came from the database or was generated from another static source. They should not manipulate data, interact with other models, make API requests, etc.
To get a new model:
$ pliny-generate model todo
created model file ./lib/models/todo.rb
created migration ./db/migrate/1408995997_create_todos.rb
created test ./spec/models/todo_spec.rb
Basics
Diving in
- bin/setup
- Config
- CORS
- Endpoints
- Error Handling
- Logging
- Models
- Mediators
- Migrations
- Rake Tasks
- Request IDs
- RequestStore
- Schema
- Serialization
- Testing
- Updating
Guides