Sha256: e81ae004f8dfd944dfa624c6cf19763e77ea6d012e32e2d73d75197e4fc2b787
Contents?: true
Size: 656 Bytes
Versions: 2
Compression:
Stored size: 656 Bytes
Contents
class Post < ActiveRecord::Base default_scope :order => "created_at ASC" has_and_belongs_to_many :tags def self.factory(text, created_at = nil) create!(:text => text, :created_at => created_at) end end class Tag < ActiveRecord::Base has_and_belongs_to_many :posts end ## seed data: year = Time.now.year 1.upto(12) do |month| month.times do |n| Post.factory "post #{n}", Time.local(year, month, 1) end end Post.factory "Today's post" Post.factory "Yesterday's post", 1.day.ago.utc Post.factory "Tomorrow's post", 1.day.from_now.utc post = Post.factory "Last year", Time.local(year - 1, 1, 1) post.tags.create(:name => "ruby")
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
radar-by_star-0.2.2 | spec/fixtures/models.rb |
radar-by_star-0.2.3 | spec/fixtures/models.rb |