This is a great video.
Is it possible to remove jQuery if you are using Bootstrap 4? I know it's a dependency but maybe if you are not using all aspects of Bootstrap you can remove it.
Anyway, removing jQuery is a good way to remove 250kb (30kb gzipped) from your website's download which is not bad at all.
Is it possible to change the default render for other one?
When Trix render I would like to use a different partial. For example _user_trix.html.erb so I can include some special content.
I believe you can define a
#to_trix_content_attachment_partial_path on your
User model, e.g.
class User < ApplicationRecord include ActionText::Attachable ... def to_trix_content_attachment_partial_path 'users/user_trix' end end
Awesome episode as usual! Few quick questions:
ActionTextis storing a
global_idreference to records in order to display the updated partial at render time, does that mean it's making a separate DB query to retrieve each of those records? For instance, if I @mention 10 separate users, will it make 10 separate calls? Especially if I'm creating a commenting system that allows @mentions, and there could be 10-20 comments, each with several @mentions, etc...
I really do like the concept of storing a reference to the partial instead of the hard-coded HTML. I'm actually in a situation where I stored the HTML snippets in the text itself and now want to change it, but am struggling with how to do that using the Froala editor. I'll eventually migrate to
ActionText in a few months after Rails 6 has been vetted in the wild.
Always appreciate your timely and very applicable videos!
Join 20,000+ developers who get early access to new screencasts, articles, guides, updates, and more.