3 ms·
These days, I'm finding a lot of joy in taking parts of a Rails app that feel clunky (meaning they usually aren't Basecamp-like, and I find myself using a lot o
by bdcravens 10y ago
These days, I'm finding a lot of joy in taking parts of a Rails app that feel clunky (meaning they usually aren't Basecamp-like, and I find myself using a lot of magic and config to make it fit a Rails-shaped hole), extracting it out as a stand-alone Sinatra app that uses Sequel instead of ActiveRecord, gemifying it, and then pulling it back into the parent monolith as an engine.
- girishso 10y agoWow! I didn't know Rails engines can be written in Sinatra/Sequel. Wondering how that works exactly.
- bdcravens 10y agoWrap your app in a class (extending Sinatra::Application or Sinatra::Base), require (I gemified it for componentization) then mount in routes: mount MySinatraApp => '/some_path' (you can also mount it as rack app in config.ru, but not sure if you'd get access to things like authenticated session, etc)
- girishso 10y agoCool. A quick search landed me on https://robots.thoughtbot.com/how-to-share-a-session-between-sinatra-and-rails https://robots.thoughtbot.com/how-to-share-a-session-between... it discusses sharing session using config.ru. Even after using rails for so many years, learning something new every day!