Skip to content

Instantly share code, notes, and snippets.

@we4tech
Created August 2, 2018 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save we4tech/a57c01ebe26368b4aec0fe27cb9994f7 to your computer and use it in GitHub Desktop.
Save we4tech/a57c01ebe26368b4aec0fe27cb9994f7 to your computer and use it in GitHub Desktop.
Create a test mountable rails engine and mount through a parent rails routes
mount RailsEngineTest::Engine => 'api/v3/'
module RailsEngineTest
class Engine < ::Rails::Engine
isolate_namespace RailsEngineTest
end
class FakeLocationsController < ActionController::Base
protect_from_forgery
def create
render text: 'hello create'
end
def index
render text: 'hello index'
end
end
Engine.routes.draw do
resources :fake_locations, only: %i[create index]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment