Jason R. Kretzer

Joined

2,220 Experience
22 Lessons Completed
0 Questions Solved

Activity

Posted in Rich Text Blog Posts with ActionText Discussion

Chris does not cover this in the video but I thought it was neat. If you want to see your video attachments actually play and not just have an image preview, you just need to modify a couple of files.
app/views/active_storage/blobs/_blob.html.erb

# change this
<% if blob.representable? %>
# to
<% if blob.video? %>
  <video controls="true" width="100%" preload="metadata">
    <source src="<%= rails_blob_url(blob) %>" type="<%= blob.content_type %>"></source>
  </video>
<% elsif blob.representable? %>

AND
config/application.rb

# add this to inside the class
config.after_initialize do
  ActionText::ContentHelper.allowed_attributes.add "style"
  ActionText::ContentHelper.allowed_attributes.add "controls"

  ActionText::ContentHelper.allowed_tags.add "video"
  ActionText::ContentHelper.allowed_tags.add "audio"
  ActionText::ContentHelper.allowed_tags.add "source"
end

Posted in Adding Scheduled Blog Posts Discussion

Use the bin/dev command to start your server as noted in video 12 (Adding TailwindCSS to Rails). Otherwise the site does not get all the tailwindcss built in.