svenfuchs/routing-filter

Inherited_resources & Simple_form gems - undefined method _path when building form

Opened this issue · 1 comments

I use inherited_resources and simple_form gems in my app.

Routes

MyApp::Application.routes.draw do
  filter :locale, :pagination,  :exclude => /^\/admin/
  resources :categories, :controller => "article/categories"
  root 'home#index'
end

my Controller

class Article::CategoriesController < ApplicationController
    inherit_resources
end

my Model

class Article::Category < ActiveRecord::Base
    translates :name, :description
    accepts_nested_attributes_for :translations
end

Form View

= simple_form_for resource do |f|
    = f.input :title 
    = f.input :description
    = f.button :submit

I get this error while loading view form

undefined method `article_category_path' for #<#<Class:0x00000002604a30>:0x000000046c86e0>

P.S. I'm using Rails_4

Please, can anyone help me to solve this?

You might not have a resource defined for 'article_category'

Check your routes with rake routes from the command prompt in your project/app root directory.

if this is the case (probably), you can just modify this line in your routes.rb (I took this from your post above) and it should do the trick:

match 'article/categories' => 'article/categories#index', :via => :get, :as => :article_category

I think the problem is that your resource is article_category and your actual URL path is article/categories