如何解决宁静的路线?
| 有没有更好的方法可以在rails 3中写入此类溃败? 我将应用程序从rails 2转换为rails 3。 匹配\“ / resume / education / edit_education \”, :controller => \“恢复/教育#edit_education \”, :as => \“简历编辑教育\”match \"/resume/education/update_education\",:controller => \"resume/education#update_education\",:as=>\"resume_update_education\"
match \"/resume/education/cancel_education_add\",:controller => \"resume/education#cancel_education_add\",:as=>\"resume_cancel_education_add\"
match \"/resume/education/cancel_education_edit\",:controller => \"resume/education#cancel_education_edit\",:as=>\"resume_cancel_education_edit\"
match \"/resume/education/remove_education\",:controller => \"resume/education#remove_education\",:as=>\"resume_remove_education\"
match \"/resume/education/update_education_title\",:controller => \"resume/education#update_education_title\",:as=>\"resume_update_education_title\"
match \"/resume/education/move_up\",:controller => \"resume/education#move_up\",:as=>\"resume_education_move_up\"
match \"/resume/education/move_down\",:controller => \"resume/education#move_down\",:as=>\"resume_education_move_down\"
match \"/resume/education/remove\",:controller => \"resume/education#remove\",:as=>\"resume_remove_education\"
解决方法
我认为您应该像这样重构控制器
class Resume::EducationController
def cancel_add
end
def cancel_edit
end
def update_title
end
def move_up
end
def move_down
end
def update
end
def destroy
end
end
然后,您可以组织路线
namespace :resume do
resource :education,:only => [:update,:destroy] do
collection do
get \'cancel_add\'
get \'cancel_update\'
get \'update_title\'
get \'move_up\' # get -> put ?
get \'move_down\'
end
end
end
看起来可以从外面引导导轨
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。