0

I'm using Rails 3.2.16 and inherited_resources 1.4.1. I needed a fast ad custom admin, so I used this post as example (it's still valid for rails 3.2):

http://iain.nl/backends-in-rails-3-1

This is what my routes files looks like:

  namespace :backend do
    root to: 'conferences#index'
    resources :conferences do
      resources :talks
      resources :sponsors
    end
  end

My Backend::ConferencesController and Backend::SponsorsController they both inherit from Backend::ResourceController as detailed in the blog post.

The problem I find is that whenever I go to the Sponsors index page, I get a NoMethodError:

NoMethodError: undefined method `backend_sponsor_path' for #<Backend::SponsorsController:0x007fa588113e08>

The weird thing it that the resource_path method is trying to find backend_sponsor_path instead of backend_conference_sponsor_path as declared in the routes.

Does anyone know how to solve this? Shouldn't inherited_resources be able to find the correct path?

Thanks!

1 Answer 1

0

OK, problem has been solved by adding belongs_to :conference to the SponsorsController:

class Backend::SponsorsController < Backend::ResourceController
  belongs_to :conference
end

Now routes are generated as expected! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.