Sha256: af105fecda46255b0e3a6ebc2dee4e571062bb8dc7d88fe6ff55a0b5e166fde2

Contents?: true

Size: 761 Bytes

Versions: 7

Compression:

Stored size: 761 Bytes

Contents

require 'ostruct'

class Post

  FIXTURES = [{
    id: 1,
    title: "Lorem ipsum whatever",
    content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tempus gravida imperdiet. Pellentesque imperdiet justo quis erat feugiat porttitor. Nulla aliquet neque vitae elit tincidunt in venenatis risus faucibus. Etiam faucibus pretium enim, et rutrum libero feugiat vitae. Donec a lectus vitae est lobortis vulputate. Nulla facilisi. Donec pellentesque pretium lectus, eu volutpat nibh molestie nec."
  }, {
    id: 2,
    title: "Foo bar baz",
    content: "Foo bar baz qux quux"
  }]

  def self.all
    FIXTURES.map do |f|
      OpenStruct.new(f)
    end
  end

  def self.find(id)
    all.find do |f|
      f.id == id.to_i
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
half-pipe-0.3.0.alpha.1 examples/rails/app/models/post.rb
half-pipe-0.2.4 examples/rails/app/models/post.rb
half-pipe-0.2.3 examples/rails/app/models/post.rb
half-pipe-0.2.2 examples/rails/app/models/post.rb
half-pipe-0.2.1 examples/rails/app/models/post.rb
half-pipe-0.2.0 examples/rails/app/models/post.rb
half-pipe-0.1.0 examples/rails/app/models/post.rb