Skip to content
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

Clone this wiki locally