问题
Okay, this continues to baffle me:
1) This is in my controller (personalias_controller.rb)
def new
@personalia = Personalia.new
end
2) I've got a model called personalia.rb
3) I've got
resources :personalias
in routes.rb
Still I get undefined method `personalia_index_path' when I try to render the personalia form as such (from within views/personalias/new.html.erb:
<%= form_for @personalia do |f| %>
It's driving me nuts :-|
回答1:
It is probably becouse personalias is not the plural of personalia, you can check this in your console using "personalia".pluralize
you could add an inflection and restart your app, here is how:
config > initializers > inflections.rb
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'personalia', 'personalias'
end
来源:https://stackoverflow.com/questions/12478612/undefined-method-model-name-index-path-for-rails-3-2