# Edit method problem with a plural-named model

**URL:** <https://www.ruby-forum.com/t/edit-method-problem-with-a-plural-named-model/157718>\
**Category:** Rails\
**Created:** [January 14, 2009, 7:24pm UTC](https://www.ruby-forum.com/t/edit-method-problem-with-a-plural-named-model/157718 "2009-01-14T19:24:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [January 14, 2009, 7:24pm UTC](https://www.ruby-forum.com/t/edit-method-problem-with-a-plural-named-model/157718/1 "2009-01-14T19:24:49Z")

</div>

Hi, I recently made a model called ‘news’. I realize that it’s plural  
and was gonna cause some problems, but I got the routing all down fine  
with:

map.resources :news, :singular =\> :news\_article

everything works fine except the EDIT method. it gives me this error:

You have a nil object when you didn’t expect it!  
The error occurred while evaluating nil.to\_sym

Extracted source (around line #2):

1: \<%= error\_messages\_for :news %\>  
2: \<% form\_for @news do |f| %\>

@news is defined in the controller like standard in an edit method:

@news = News.find(params[:id])

The @news retrieves the data correctly, I’ve tested it, so the problem  
is with \<%form\_for @news do |f|%\>. What’s wierd is my create method  
works just fine with  
@news = News.new. But when I give @news a value, it won’t work. I just  
want to know how to make edit work with a plural model like this. I’ve  
searched extensively and can’t seem to find out.

P.S. I saw someone reccomend doing

ActiveSupport::Inflector.inflections do |inflect|  
inflect.uncountable “news”  
end

in the inflector file but it didn’t work for me. I assume you need to  
have that there before you create the model, which I didn’t. Any help  
would be greatly appreciated!
