Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherited_resources & Simple_form gems - undefined method _path when building form #49

Open
mcmegavolt opened this issue Aug 15, 2013 · 1 comment

Comments

@mcmegavolt
Copy link

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?

@flakd
Copy link

flakd commented Aug 26, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants