# Especificación del controlador del plugin: las rutas del plugin no se dibujan

**URL:** <https://meta.discourse.org/t/plugin-controller-spec-plugin-routes-are-not-drawn/108606>\
**Category:** Development\
**Created:** [7 Febrero, 2019 15:35 UTC](https://meta.discourse.org/t/plugin-controller-spec-plugin-routes-are-not-drawn/108606 "2019-02-07T15:35:54Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![kleinfreund](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@kleinfreund](https://meta.discourse.org/u/kleinfreund)\
**Post date:** [8 Febrero, 2019 14:51 UTC](https://meta.discourse.org/t/plugin-controller-spec-plugin-routes-are-not-drawn/108606/7 "2019-02-08T14:51:47Z")

</div>

For who might experience the same problem as described above, one way I am able to get the routes drawn with an engine was defining the engine inside `plugin.rb` rather than `lib/engine.rb`.

```ruby
after_initialize do
  # …

  module ::Plugin
    class Engine < ::Rails::Engine
      engine_name Plugin::PLUGIN_NAME
      isolate_namespace Plugin
    end
  end

  Plugin::Engine.routes.draw do
    get '/my_routes' => 'routes#index'
    put '/my_routes/:route_id' => 'routes#update'
    delete '/my_routes/:route_id' => 'routes#destroy'
  end

  Discourse::Application.routes.append do
    mount Plugin::Engine, at: '/plugin', constraints: AdminConstraint.new
  end
end

```

Why that makes any difference is beyond me.

* * *

As for the strategy that was suggested: Yes, I could certainly try re-implementing my plugin starting with one of the default plugins and observe at which point the described failure occurs. However, that’s very impractical as I’ve working on the plugin for close to a year.

---

_[View the full topic](https://meta.discourse.org/t/plugin-controller-spec-plugin-routes-are-not-drawn/108606)._
