Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class User < ApplicationRecord
has_many :event_instances
has_many :commit_counts
has_many :status
has_many :courses

has_many :subscriptions, autosave: true

Expand Down
25 changes: 24 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

klasses = [Project, Document, User, Subscription, Karma, Plan, Article, Event, EventInstance, Karma]
klasses = [Project, Document, User, Subscription, Karma, Plan, Article, Event, EventInstance, Karma, Course]
old_counts = klasses.map(&:count)
should_prompt = old_counts.min.positive?

Expand Down Expand Up @@ -77,6 +77,20 @@ def get_country
)

puts 'Created default projects'

u.courses.create!(
title: 'OpenSource',
description: 'How to contribute to open source projects.',
status: 'Active'
)

u.courses.create!(
title: 'GitCourse',
description: 'Learn how to use git and github.',
status: 'Active'
)

puts 'Created default courses'
break
elsif %w(n no).include?(response)
break
Expand Down Expand Up @@ -108,6 +122,15 @@ def get_country
)
end
end

3.times do
p = u.courses.create(
title: Faker::Educator.course_name,
description: Faker::TvShows::GameOfThrones.quote,
status: 'active',
created_at: 1.month.ago
)
end
end

# Premium Users
Expand Down