Flixter is a a two sided video streaming marketplace platform, featuring credit card payment capabilities, user role management, complex user interfaces and advanced database relationships.
User's Course Show Page
Instructor Course Page
Requirements
- App to have student and instructor accounts.
- Once logged in, a student or instructor index page should list all classes.
- For students, you can -
- sign up for a class
- go to class to watch a video
- pay for it with a credit card using stripe
- For instructors, you can -
- change course order
- set course price
- add sections
- add courses
Student Video Lesson Page
Student Payment Modal
Implementation
Add User Authentication to the Rails App with the Devise gem. Go through documentation to add the necessary features you want. Generate the User model with rails generate devise User
Rails also generates a migration file, model, spec file and routes for :users.
Add Course model, validation, controller and views
rails generate model course
class Course < ApplicationRecord
belongs_to :user
end
Add Course controllers - for students and instructors
- use
namespaces
to nest routes
namespace :instructor do
resources :courses, only: [:new, :create, :show]
end
class Instructor::CoursesController < ApplicationController
before_action :authenticate_user!
def new
@course = Course.new
end
def create
@course = current_user.courses.create(course_params)
redirect_to instructor_course_path(@course)
end
def show
@course = Course.find(params[:id])
end
private
def course_params
params.require(:course).permit(:title, :description, :cost)
end
end