Controllers and form_for

I'm a bit confused on how this works. My form is sending to a weird location. Here's my situation:

I have a model: youtube.rb I have a controller called: youtube_editor_controller.rb

In my youtube_editor view, i have new.html.erb, where I'm trying to make a form for the var I created in my youtube_editor_controller.rb:

  def new   @video_new = Youtube.new   end

SO, I use the form_for @video_new, but when I view the page, the form action="/youtubes". Why is it doing that? Did I define "youtubes" or is it just pluralizing my model name? Where does it decide which controller to go to?

SO, I use the form_for @video_new, but when I view the page, the form action="/youtubes". Why is it doing that? Did I define "youtubes" or is it just pluralizing my model name? Where does it decide which controller to go to?

that comes from your routes.

Fred

OK, I have this in my routes:

  map.resources :youtube_editor   map.resources :youtubes

I deleted youtubes and I got an error. (I think "youtube" is my model name, but "youtubes" may be my table name. "youtube_editor" is my controller. How do I get the resource youtube_editor linked to the @video_new variable? (if that's how it works...)

THanks!

OK, I have this in my routes:

map.resources :youtube_editor map.resources :youtubes

I deleted youtubes and I got an error. (I think "youtube" is my model name, but "youtubes" may be my table name. "youtube_editor" is my controller. How do I get the resource youtube_editor linked to the @video_new variable? (if that's how it works...)

you'll make life easier for yourself if you stick to the default (ie
the controller for editing instances of Youtube should be
youtubes_controller). You should be able to the :controller option to
override that if you want.

Fred

So, models and controllers should always have the same name?