Skip to content

Instantly share code, notes, and snippets.

View pedromschmitt's full-sized avatar
🎲

Pedro Schmitt pedromschmitt

🎲
View GitHub Profile
@pedromschmitt
pedromschmitt / img_convert.rb
Last active February 27, 2019 10:39 — forked from arirusso/img_convert.rb
convert html img tags to rails image_tag calls
#!/usr/bin/env ruby
require "nokogiri"
# opens every file in the given dir tree and converts any html img tags to rails image_tag calls
#
# example usage:
# ruby convert.rb ~/my_rails_app/app/views
#
# ***be careful and backup before using this***
#
@pedromschmitt
pedromschmitt / rails http status codes
Created November 29, 2020 12:26 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@pedromschmitt
pedromschmitt / linux-setup.sh
Created June 4, 2024 21:36 — forked from dhh/linux-setup.sh
linux-setup.sh
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils

Integration of TinyMCE in Rails 7 with Turbo Drive Support

Since Rails 7 the turbo-rails library is included by default. Turbo Drive intercepts link clicks and form submits. It makes sure that only the <body> part of the page is rerendered instead of the whole page.

This leads to TinyMCE not being properly detached and reattached when a Turbo Drive response is rendered. The textarea will appear without the TinyMCE editor. In this post we expand on the tinymce-rails gem with a Stimulus controller to prevent this issue. The controller helps to reattach TinyMCE and respects the settings in config/tinymce.yml.

If you want to follow along or check out the end result you can find an example respository here: https://github.com/david-uhlig/example-tinymce-rails7-turbo

Instructions