Create Wistia model in Ruby on Rails

94 views Asked by At

I am building currently an web app where the admin will be able to post a title with a description and a link / embedded form of Wistia Video Player.

Currently my setup is:

  • Welcome Page
  • Dashboard Page with Dashboard Controller (here only the admin will be able to post, edit things, all other users can only watch/comment)

How do i create a model for this? Normally i would create a model like this:

rails g model Video title:string description:text 

But how do i implement the Wistia Video Player, so that everytime the Admin creates a new post, he will be able to link/embedded a new video?

1

There are 1 answers

2
CodingSnow On

If I got you right then you want a permissions system that gives a user with the role "Administrator" the ability to create a new post with an embedded video? Normal "users" shouldn't be able to do this, right? Do you already have a "Login system" or something familiar? If not you should create a permissions system with sessions and stuff like that. (keyword: has_secure_password, BCrypt and sessions). After creating the system you could just use a before_action in your video controller or however you called it. With the before action you could simply check if the user that is logged in has the role "Administrator". If you only want to forbid embedding videos then just check the post before saving it to your table in the database.