4 ms·
I wish Rails had a way to use less features. API mode is great, but when I'm writing a GraphQL API for instance, I don't use controllers, I don't use views, I d
by _hardwaregeek 7y ago
I wish Rails had a way to use less features. API mode is great, but when I'm writing a GraphQL API for instance, I don't use controllers, I don't use views, I don't really use routing. I do use the excellently integrated ORM, database migrations, auth libraries (mostly devise), config environments, deployment options and CLI interface.
I could just delete the folders, but that's not the point. Rails is sitting on an amazing foundation but there's only one possible house that you can build.
- deleted 7y ago[deleted]
- mullsork 7y agoYou can opt out of loading the library code for views/mailers/etc. Not sure if there's a way to skip the routing layer though. I'm sure you're aware of that already but just in case, you can skip loading the entire framework.
- ewalk153 7y agoUse a Sinatra app and include ActiveRecord. There are a few gotchas like making sure to clear connections at the end of requests. https://stackoverflow.com/questions/41400202/replacing-activerecordconnectionadaptersconnectionmanagement-in-activerecord https://stackoverflow.com/questions/41400202/replacing-activ... I’d love to see more examples of picking pieces of rails and combining with other libraries.
- _hardwaregeek 7y agoThe only concern I have is that because AR isn't designed as a separate gem, there's no guarantees about breaking changes. But I suppose that's unlikely.
- deleted 7y ago[deleted]
- timdorr 7y agoWhen you use `rails new`, there are a bunch of `--skip-*` flags to turn off various features of the framework: https://gist.github.com/aklap/ee4bb619a77b80bf0c934a9948dc49a2#file-rails_new_output-txt https://gist.github.com/aklap/ee4bb619a77b80bf0c934a9948dc49... Those carry through to the boot process and never even get loaded into memory: https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/config/application.rb.tt#L10-L19 https://github.com/rails/rails/blob/master/railties/lib/rail...