Sha256: 61ea557dd8b7895db6df031dda063b3eb348b16cb4d42c25dcbae7bb9ed14b5e

Contents?: true

Size: 451 Bytes

Versions: 3

Compression:

Stored size: 451 Bytes

Contents

class Event < ActiveRecord::Base
  belongs_to :user, :class_name => 'User', :foreign_key => :creator_id
  has_many :event_users
  
  def self.random
    find(:first, :offset => rand(count - 1))
  end
  
  def self.generate_random_data(count = 500)
    0.upto(count) do |index|
      create(:user => User.random, :name => "Event #{index}", :headline => "Event Headline #{index}", :start_time => (Time.now + rand(100).hours))      
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
will_filter-3.1.3 test/dummy/app/models/event.rb
will_filter-3.1.2 test/dummy/app/models/event.rb
will_filter-3.1.1 test/dummy/app/models/event.rb