i simplified have a news model, a news category model and a news
controller.
my _news.rhtml partial renders a single news entry.
in my controller there are the actions show and show_category.
if the "show" action is called, a single news item is rendered through
my partial with no errors.
if the "show_category" action is called, i get a NoMethodError while
displaying my news through the partial.
have you tried testing the News class and the NewsCategory class
associations? I see a has_many association in the first full trace..
Can you test if it the news_category is working correctly?
You were almost there originally... you just need to pass the first
call to render a locals hash so that the news variable in the partial
is populated correctly. The collection render does it automatically.
BTW, your problem does not appear to have anything to do with Rails
pluralization.
def show
@news = News.find(params[:id])
render :partial => 'news', :locals => { :news => @news }
end
did not realy understand what the News:Class came from but… its gone now and iam happy
i’ll try to understand this later after finishing (finally) my tiny app.