-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Adding a Course
Kevin Mulhern edited this page Feb 23, 2023
·
6 revisions
- First find the path you want to add the course to under the
db/fixtures/paths/
directory. - Create a new file under the
db/fixtures/paths/<selected_path>/courses/
directory which will store your course structure - name the new file the same as what you intend to display as the course name on the site. For examplejavascript_basics.rb
orruby.rb
etc. - Find the
seed.rb
file for the path you will be adding the course todb/fixtures/paths/<your selected path name>/seed.rb
- Within the paths seed.rb file, load your course by adding this line to the courses list:
load './db/fixtures/paths/<your selected path>/courses/<your new course name>.rb'
- The order of the course list matters, they are displayed on the site in the same order so ensure you add your new course to the position in the list that you want it to be displayed on the site.
- At the top of the new course file create your new course:
course = @path.add_course do |course|
end
- Give the course a title:
course = @path.add_course do |course|
course.title = 'JavaScript Basics'
end
- Give the course a description:
course = @path.add_course do |course|
course.title = 'JavaScript Basics'
course.description = 'A JavaScript Basics course'
end
- Give the course an identifier_uuid attribute value of
'create_uuid'
. This will be replaced by a real uuid automatically when the seed script is run later.
course = @path.add_course do |course|
course.title = 'JavaScript Basics'
course.description = 'A JavaScript Basics course'
course.identifier_uuid = 'create_uuid'
end
- Add sections and lessons to the course using these guides:
- Add the cleanup step to the bottom of the course file - this will take care of any sections and lessons that are removed from the course in the future.
course.delete_removed_seeds
- Run the seeds task:
bin/rails db:seed
- Run the app locally and check the course is where it should be.
- All done 🎉
Wiki Home | Odin Web App Home | Odin Site Home | Odin Org Home
Want to contribute to this wiki? Open an issue to suggest changes and improve these docs 🚀