Rails 4.1.5 Engine's Routes Not Showing Up In Rake Routes — Believe It's Naming Convention

752 Views Asked by At

So I am working on trying to add a Rails 4.1.5 engine/plugin to our project which are then loaded by rails. Running rake routes shows the other engines which I have modeled my code after but I believe I may be running into issues with Rails naming conventions which I am not familiar with. For the purpose of I've created the engine using the following command:

rails plugin new modules/admin/new_functions --skip-bundle --full

This created the skeleton for the engine. I ensured that I used a plural name for the engine per this piece of Rails documentation. My controller is:

module Admin
    class NewFunctionsController < AdminController
        def index
        end

        def create
        end
    end
end

My config/routes.rb file is as follows. I'm unsure if the resources :new_functions correctly maps to the controller I have but I'm not sure what the correct form would be.

Rails.application.routes.draw do
    namespace :admin do
        resources :new_functions
    end
end

The directory structure is:

new_functions
|-- app
    |-- assets
          |-- javascripts
              |-- admin
                  |-- new_functions
                      |-- supporting javascript files
    |-- controllers
          |-- new_functions_controller.rb
    |-- views
          |-- admin
              |-- new_functions
                  |-- supporting HTML/ERB files
|-- config
    |-- routes.rb
|-- lib
    |-- new_functions.rb
    |-- new_functions
          |-- engine.rb
          |-- version.rb
|-- test
    |-- new_functions_test.rb
    |-- test_helper.rb
|-- Gemfile
|-- Gemfile.lock
|-- Rakefile
|-- new_functions.gemspec

Would greatly appreciate any advice that you may have regarding identifying this issue and fixing it. Any steps or reading that I can do to find the issue would also be helpful.

Thank you all for your time.

1

There are 1 best solutions below

0
On BEST ANSWER

After further research it seems as though someone had added "Spring" to the application, which caches rake routes. Stopping spring bin/spring stop and then running rake routes fixed the issue with the routes not appearing.