Assume I setup a route in my plugin like this:
plugin.rb
:
get '/css/styles.css' => 'plugin_routes#show'
./app/controllers/plugin_routes_controller.rb
:
class PluginRoutesController < ApplicationController
def show
Rails.logger.info '┌────────────┐'
Rails.logger.info '│ Here we go │'
Rails.logger.info '└────────────┘'
end
end
Why is it that I get the following output when the method above is not actually being called? The Here we go part is absent from the logger output. How do I get the show
method from above to be called?
I, [2018-07-12T16:45:17.108958 #30583] INFO -- :
Processing by PluginRoutesController#show as CSS
I realize that I can process such a route by adding an appropriate route configuration to the frontend also and then send an AJAX request to the same URI. This will eventually call the mentioned show
method. How do I accomplish this without going through the frontend?
Other topic with the same problem: Plugin Controller Method never called. Its conclusion is to have an Ember controller in the frontend as well, but this is exactly what I try to avoid.