title: RailsAdmin Custom Controller
body: <p>I'm writing a custom rails_admin controller (Backend::ImagesController) which inherits from RailsAdmin::MainController.</p>
  
  <p>I followed the steps <a href="https://stackoverflow.com/questions/8845480/customize-rails-admin-to-include-self-created-views-and-controllers">in this answer</a>, but I'm getting an undefined_method error when my view uses the route helper backend_image_path(@image).</p>
  
  <p>The controller is defined under controllers/backend/images_controller.rb as:</p>
  
  <pre><code>module Backend
    class ImagesController &lt; RailsAdmin::MainController
      #layout 'rails_admin/cropper'
  
      skip_before_filter :get_model
      skip_before_filter :get_object
      skip_before_filter :check_for_cancel
  
      .... the various actions ....
  </code></pre>
  
  <p>My routes are defined as:</p>
  
  <pre><code>namespace 'backend' do
    resources :images do
      member do
        get :cropper
        post :crop
      end
    end
  end
  
  mount RailsAdmin::Engine =&gt; '/backend', :as =&gt; 'rails_admin'
  </code></pre>
  
  <p>And the output of rake routes is what I expect:</p>
  
  <pre><code>backend_image GET  /backend/images/:id(.:format) backend/images#show {:protocol=&gt;"https://"}
  </code></pre>
  
  <p>Finally, from rails console:</p>
  
  <pre><code>app.backend_image_path(id: 10)
  =&gt; "/backend/images/10"
  </code></pre>
  
  <p>This controller worked flawlessly until I tried to integrate it in RA by having it extend RailsAdmin::MainController </p>
  
  <p>I do not know why the route_helper is not accessible from the controller anymore....</p>