I have a little problem with routing while code new application on rails
3.0.4.
My config/routes.rb:
Zi::Application.routes.draw do
...
scope "/cpd", :controller => :control_pds do
match "index" => :index
match ":org_id" => :show, :as => "cpd"
match ":org_id/new" => :new, :as =>
"new_control_pds"
post ":org_id/create" => :create, :as =>
"control_pds"
match ":org_id/:id/edit" => :edit, :as =>
"edit_org_cpd"
put ":org_id/:id/update" => :update, :as =>
"control_pd"
delete ":org_id/:id" => :destroy, :as =>
"del_org_cpd"
end
...
end
My control_pds_controller.rb:
class ControlPdsController < ApplicationController
...
def edit
@journal = ControlPd.find(params[:id])
end
...
end
In my view file I have:
...
- @journal.each do |j|
%tr
%td= j.id
%td= j.event
%td= j.date
%td= j.doer
%td= j.result
%td
= link_to "Edit", edit_org_cpd_path(j)
...
When I clicking edit link for my journal entry (url
http://localhost:3000/cpd/1/5/edit) in page source code I have:
<form accept-charset="UTF-8" action="/cpd/5/5/update"...
But logically it seems to be like:
<form accept-charset="UTF-8" action="/cpd/1/5/update"...
While accessing edit page in development.log I have valid parameters:
Started GET "/cpd/1/5/edit" for 127.0.0.1 at Sat Feb 19 12:03:53 +0300
2011
Processing by ControlPdsController#edit as HTML
Parameters: {"org_id"=>"1",
"id"=>"5"}
...
What I do incorrect?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.