app/models/content.rb
# Sanitize url to pass in the right url to embed youtube video
Sanitize url to pass in the right url to embed youtube video
Sanitize url to pass in the right url to embed youtube video
def sanitize_video_url
    if self.video_url
      self.video_url = self.video_url.split('/').last 
      if self.video_url.include? "watch?v="
        self.video_url = self.video_url.split('=').last
      end
    end
  end
def sanitize_video_url if self . video_url self . video_url = self . video_url . split ( '/' ) . last if self . video_url . include? "watch?v=" self . video_url = self . video_url . split ( '=' ) . last end end end
Sanitize url to pass in the right url to embed youtube video
Sanitize url to pass in the right url to embed youtube video