0

So my Rails controller isn't working (properly) for some reason.

I first noticed something funny when I opened the controller file for the first time.

Vim Sytax Highlighting Pr

Compare this to normal syntax highlighting. (Also notice the overly long name)

Normal Syntax Highlighting

This was the error I got when I tried to create a link in one of my views.

ActionView::Template::Error (undefined method `new_voyage_at_port_log_entries_path' for #<#<Class:0x007fb1c5921a98>:0x007fb1c81a32a0>):

Here's proof that I inserted this in my routes.

resources :voyage_at_port_log_entries

I do have it working by creating manual routes, but that is a little awkward, and I may forsee problems later. Why might ActionView not be working?

ovatsug25
  • 7,786
  • 7
  • 34
  • 48

1 Answers1

0

DUH! Routes are created for the singular version.

So...

new_voyage_at_port_log_entry_path

works!

BUT...syntax highlighting is still off... Hmmm...not important but weird...probably has a different pluralization engine?

ovatsug25
  • 7,786
  • 7
  • 34
  • 48
  • The routes created by `resources` use both singular and plural names, as appropriate to the context. If you're operating on a collection (the index path, for example), it'll use a plural name. If you're operating on a single item (show, update, etc.), it'll use a singular name. Syntax highlighting is your editor's responsibility and has nothing to do with Ruby, Rails, or the pluralization system. – Jim Stewart Dec 11 '12 at 22:07