josh-works / rails-auth-from-scratch-03

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Trix editor and tailwind for "longblob" text content

josh-works opened this issue · comments

https://github.com/basecamp/trix

attach it to BookQuote#quote

I'd like the bookquote#new page to look like what is featured here: https://trix-editor.org

2022-02-12 at 2 45 AM
/

Spent just a few minutes on this, basically followed exactly https://levelup.gitconnected.com/trix-rich-editor-for-your-rails-6-application-7b89e2f33de8, even though this is Rails 7.

10148* git co -b add-trix-to-bookquote
10149* bin/dev
10152  rails action_text:install
10153  b rails db:migrate
			gem install image_processing

Made the suggested changes, pretty much.

2022-02-12 at 3 08 AM

Still not quite getting there.

2022-02-12 at 3 11 AM

Getting gnarly output like this in the terminal:

 DEBUGGER[bin/rails#48406]: Attaching after process 47783 fork to child process 48406
03:13:14 web.1  | [47783] - Worker 0 (PID: 48406) booted in 0.0s, phase: 0
03:13:15 web.1  | Started GET "/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--382f51168fc84af826aabda4b66213f2f9d301c1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFJQUJHa0NBQU09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--dd6545078193d7d5526144e415ae1525d26ffdcd/2022-02-12%20at%203.08%20AM.jpg" for 127.0.0.1 at 2022-02-12 03:13:15 -0700
03:13:15 web.1  |   ActiveRecord::SchemaMigration Pluck (0.8ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
03:13:15 web.1  | Processing by ActiveStorage::Representations::RedirectController#show as JPEG
03:13:15 web.1  |   Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--382f51168fc84af826aabda4b66213f2f9d301c1", "variation_key"=>"[FILTERED]", "filename"=>"2022-02-12 at 3.08 AM"}
03:13:15 web.1  |   ActiveStorage::Blob Load (0.5ms)  SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2  [["id", 2], ["LIMIT", 1]]
03:13:15 web.1  |   ActiveStorage::VariantRecord Load (0.6ms)  SELECT "active_storage_variant_records".* FROM "active_storage_variant_records" WHERE "active_storage_variant_records"."blob_id" = $1 AND "active_storage_variant_records"."variation_digest" = $2 LIMIT $3  [["blob_id", 2], ["variation_digest", "g9oDsuZ2Ke1OimlPvx7V2sj306E="], ["LIMIT", 1]]
03:13:15 web.1  |   Disk Storage (0.2ms) Downloaded file from key: o6mqbhp7y0cwl4agsnp1c9ll8zbq
03:13:15 web.1  | Completed 500 Internal Server Error in 151ms (ActiveRecord: 32.8ms | Allocations: 51752)
03:13:15 web.1  |
03:13:15 web.1  |
03:13:15 web.1  | #<Thread:0x00007ffcfdccc250 /Users/joshthompson/.rvm/gems/ruby-3.0.1/gems/actionpack-7.0.2/lib/action_controller/metal/live.rb:340 run> terminated with exception (report_on_exception is true):
03:13:15 web.1  | /Users/joshthompson/.rvm/gems/ruby-3.0.1/gems/ffi-1.15.4/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library 'gobject-2.0.0': dlopen(gobject-2.0.0, 5): image not found. (LoadError)
03:13:15 web.1  | Could not open library '/usr/local/lib/libgobject-2.0.0.dylib': dlopen(/usr/local/lib/libgobject-2.0.0.dylib, 5): Library not loaded: /usr/local/opt/libffi/lib/libffi.7.dylib
03:13:15 web.1  |   Referenced from: /usr/local/Cellar/glib/2.68.2/lib/libgobject-2.0.0.dylib
03:13:15 web.1  |   Reason: image not found
03:13:15 web.1  | 	from /Users/joshthompson/.rvm/gems/ruby-3.0.1/gems/ffi-1.15.4/lib/ffi/library.rb:99:in `map'
03:13:15 web.1  | 	from /Users/joshthompson/.rvm/gems/ruby-3.0.1/gems/ffi-1.15.4/lib/ffi/library.rb:99:in `ffi_lib'
03:13:15 web.1  | 	from /Users/joshthompson/.rvm/gems/ruby-3.0.1/gems/ruby-vips-2.1.0/lib/vips.rb:137:in `<module:GOb

Looks like the key could be Could not open library '/usr/local/lib/libgobject-2.0.0.dylib':

Or, more specifically:

ruby-3.0.1/gems/ffi-1.15.4/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library 'gobject-2.0.0': dlopen(gobject-2.0.0, 5): image not found. (LoadError)

Found libvips/ruby-vips#141, linked to libvips/ruby-vips#130,

brew update
brew install vips

HOLY COW THIS TAKES FOREVER! What the heck is VIPS?

"something Image Processing... System?" with low-memory needs? https://github.com/libvips/libvips

OK, whatever. I think it'll work once it's installed...

Got this error in the terminal:

==> Installing vips dependency: libmpc
==> Pouring libmpc--1.2.1.catalina.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/mpc.h
Target /usr/local/include/mpc.h
is a symlink belonging to libmpc@0.8. You can unlink it:
  brew unlink libmpc@0.8

Also ended up with libvips/ruby-vips#284, which might be exactly what I need. Hopefully won't take me "hours". Holy cow, feels like I'm installing a new operating system. This feels really heavy-duty.

These threads are REALLY in the weeds. Makes me feel way less good about Trix, if I'm going to have this hell of running it on everyone's machine.

What ELSE did people use for rich text fields in rails, before trix?

On the flip-side, it seems NICE to get so much WRT images for so little code.

2022-02-12 at 3 32 AM

Ugh battery has gone from like 30% to 8% while installing this. How is it not done??? Plugging in, but on a crappy charger, putting screen to sleep, 🤞 it works!