Rails 3 routes: different auto routes for the model

so I have a model class called Photoset and a controller named Sets. ive gets resources: sets the job for everything except when paths are generated from the model instance. for example, if I use:

<%= form_for(@photoset) do |f| %>

I get an error:

 no route matches {:controller=>"sets"}

Ultimately, I want all uris to be ... / sets / ... (controller name) instead of ... / photosets / ... (model name)

Is there any way to do this and still use helpers?

- EDIT - heres my rake output:

    sets GET    /sets(.:format)          {:controller=>"sets", :action=>"index"}
         POST   /sets(.:format)          {:controller=>"sets", :action=>"create"}
 new_set GET    /sets/new(.:format)      {:controller=>"sets", :action=>"new"}
edit_set GET    /sets/:id/edit(.:format) {:controller=>"sets", :action=>"edit"}
     set GET    /sets/:id(.:format)      {:controller=>"sets", :action=>"show"}
         PUT    /sets/:id(.:format)      {:controller=>"sets", :action=>"update"}
         DELETE /sets/:id(.:format)      {:controller=>"sets", :action=>"destroy"}

that everything works just dandy, the problem is that I'm trying to create a form on a model instance. I understand that the rails do not know that I am trying to connect the Photoset model directly to the Set controller, but I do not know how to indicate this.

+5
2

Photoset, URL- /sets/1/edit.

resources :sets, :as => "photosets"

:

<%= form_for(@photoset) do |f| %>
    <%= f.text_field :title %>
    <%= f.submit "Save" %>
<% end %>
+10

resources :photosets, :as => "sets"

photosets_path, photoset_path, new_photoset_path .., URL sets

,

-1

All Articles