Routing error

Hi guys,
i have a model named “project” and i have created routes namespace:
namespace :project do
resources :inprocess do
get ‘assign’, :on => :collection
end
resources :suggested do
get ‘select_list’, :on => :collection
post ‘select_list’, :on => :collection
end
resources :finished
end

One of the routes that i get is new_project_suggested (which is
working fine with the new action) and the edit_project_suggested which
i get an error.
I am calling this action in the “select_list” view:

<% @suggested.each do |s| %>

<%= link_to "#{s.title}", edit_project_suggested_path(s) %> <% end %>

The strange is that it does go to the url
http://127.0.0.1:3000/project/suggested/21/edit
but i get the error “Routing Error uninitialized constant
ProjectController”.

The actions in the project/suggested controller are:
def select_list
@suggested = Project.find_all_by_status(“suggested”)
end

def edit
@project = Project.find(params[:id])
end

Can you help me with this?? It does not make sense! :confused:

Thank u in advance

Any ideas guys??? I would appreciate any suggestion!

Regards
Kostas

Try this route format:

namespace :project do
resources :inprocess do
collection do
:get => ‘assign’
end
end
resources :suggested do
collection do

      :get => 'select_list'
          :post =>  'select_list'
      end
  end

namespace :project do
resources :inprocess do
collection do
get => ‘assign’

end
resources :suggested do
get ‘select_list’, :on => :collection
post ‘select_list’, :on => :collection
end
resources :finished
end

Kostas L. wrote in post #976978:

Hi guys,
i have a model named “project” and i have created routes namespace:
namespace :project do
resources :inprocess do
get ‘assign’, :on => :collection
end
resources :suggested do
get ‘select_list’, :on => :collection
post ‘select_list’, :on => :collection
end
resources :finished
end

I think you’re abusing nested resources. inprocess, suggested, and
finished probably shouldn’t be resources of their own. What are you
trying to achieve here?

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone

Hi Marnen,
i have created a projects controller with a field called status. The
“status” have the following values: “suggested”, “inprogress” and
“finished”. I want to be able to use these actions:
project/suggested/new
project/suggested/1/edit
project/suggested/assign_to_student


project/finished/new
project/finished/1/edit
etc

The goal is to be able to edit,update,create, delete (and some other
actions) a project while having a specific status. The forms in each
value should be different.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs