HEXAGONAL RAILS Describes structure of application but... Rails is not the application ... Rails is the HTTP Adaptor Describes building apps *with* Rails
resources :one, controller: :generic, type: One resources :two, controller: :generic, type: Two controller GenericController def show params[:type].find params[:id] end #snip... end Router
Constraints class IsAdmin def self.matches? request request.env[‘warden.env’].user!.is_admin? end end class IsUser def self.matches? request request.env[‘warden.env’].user! end end
Constraints constraint AllowedAccess.new(:beta) do resource :shiney_thing end class AllowedAccess < Struct.new(:feature) attr_reader :feature def matches? request unless Features.new(user).allow? feature throw :warden, Warden::Redirect... end end end