3 ms·
Hm, I never found adding custom routes to Rails painful - could you elaborate? Anyway, for smaller use cases I found Sinatra + ActiveRecord a great match.
by wukerplank 8y ago
Hm, I never found adding custom routes to Rails painful - could you elaborate? Anyway, for smaller use cases I found Sinatra + ActiveRecord a great match.
- LeonidBugaev 8y agoI'll be frank, the latest Rails version I used was Rails 3, and it was like 6 years ago, so I can't really remember details, except that I had to spread logic to like 3 files to make it work. Maybe things changed.
- yxhuvud 8y agoNo, you didn't have to spread out the logic like that in Rails3. You could do something like class AsController < ApplicationController def index end class BsController < ApplicationController def create end end end with routes like resources :as do resources :bs, controller: "as/bs", only: :create end
- ryanbrunner 8y agoEven that is resourceful routing, just with nested resources. Doing a flat out custom route is even easier: class AsController < ApplicationController def custom end end routes: resources :as do member { get :custom } end
- yxhuvud 8y agoYes, of course. The whole point of my example was that it is possible to do resourceful routing in a single file without having to resort to using custom routes. I try to avoid custom routes whenever possible - in my experience they lead to pain in the long run, more often than not.
- rajangdavis 8y agoSinatra is awesome! Had a project recently where Active Record and Postgres with Sinatra made sense and it was completely painless. Rails _might_ have helped, but I have come to enjoy Sinatra's flexibility. Been debating about making something in between, but working on other things.