Sha256: 5a96ad45dd7b2f5d335ed159e973cb4f5259288bf1a0548fa562c8c959424a56
Contents?: true
Size: 361 Bytes
Versions: 15
Compression:
Stored size: 361 Bytes
Contents
class Post include ActiveModel::Model attr_accessor :id, :title, :body POSTS = [ {id: 1, title: 'Title One', body: 'Body One'}, {id: 2, title: 'Title Two', body: 'Body Two'} ] def self.all POSTS.map {|attrs| new(attrs) } end def self.find(id) all.detect {|post| post.id == id.to_i } end def to_param id end end
Version data entries
15 entries across 15 versions & 1 rubygems