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!