Sha256: 47eb8afffab847b29cf9f82c68e198da941601acdfc6f275868180699d9d681d
Contents?: true
Size: 899 Bytes
Versions: 2
Compression:
Stored size: 899 Bytes
Contents
module ActionDispatch::Routing class Mapper # # # def mount_api(raisin_api) raisin_api.routes.each do |method, path, endpoint| send(method, path, to: endpoint) # get '/users', to: 'users#index' end end end class RouteSet class Dispatcher # # Allow to use controller like 'UsersAPI' instead of 'UsersController' # def controller_reference_with_api(controller_param) controller_name = "#{controller_param.camelize}Api" unless controller = @controllers[controller_param] controller = @controllers[controller_param] = ActiveSupport::Dependencies.reference(controller_name) end controller.get(controller_name) rescue NameError controller_reference_without_api(controller_param) end alias_method_chain :controller_reference, :api end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
raisin-0.0.2 | lib/raisin/rails/routes.rb |
raisin-0.0.1 | lib/raisin/rails/routes.rb |