> On Jan 20, 2019, at 8:03 PM, Walter Lee Davis <
wa...@wdstudio.com> wrote:
>
>
>> On Jan 20, 2019, at 4:39 PM, fugee ohu <
fuge...@gmail.com> wrote:
>>
>> how do gems add their routes to an app
>>
>
> The simplest way is if the gem has a config/[gem name]/routes.rb file
sorry, this should be config/routes.rb, the gem name isn't in that path
> in its directory structure. If it does, then the routes defined in that file will be merged into whatever other routes you define in your own routes.rb file in your application. When such a route has been merged into your app, you can see it when you type `rake routes` at the command prompt. It will be set off from the other routes, usually by a namespace.
>
> Note that Rails uses the "first match wins" strategy here, so if you want to override a route that will be claimed later by a gem (gem routes load after the application's own routes) then if your app defines the same route, whatever you have defined in your routes file will own that route, and the route defined in the gem will be ignored.
>
> I believe there are other ways that a route can be defined programmatically, consult the Rails Guide on "Routing from the outside in" for details and links to the API documentation.
>
> Walter
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to
rubyonra...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/50714B08-1D89-4E4F-940C-5AFD7F15DC90%40wdstudio.com.
> For more options, visit
https://groups.google.com/d/optout.