Created
August 2, 2018 15:21
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mount RailsEngineTest::Engine => 'api/v3/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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