2011-08-09 6 views
1

저는 사람들이 프로젝트 및 프로젝트 관련 업데이트를 포함하여 개인 프로필을 업로드 할 수있는 프로젝트 작업을하고 있습니다.Rails3에서 원격 양식 제출이 네임 스페이스와 작동하지 않습니다.

다음을 사용하여 양식을 제출하고 싶다는 점을 제외하고는 모든 것이 잘 작동합니다. remote => true 그러나 작동하도록 할 방법이 없습니다. 고전 jquery/ajax를 사용하여 양식을 제출할 수 있지만 Rails3 UJS는 훌륭합니다!

updates_controller.rb

def create 
@update = Update.new(params[:update]) 
@update.user_id = current_user.id 
@update.project_id = params[:project_id]  

if @update.save 
    respond_to do |format| 
    format.js { render :nothing => true } 
    end 
end 
end 

_form.html (플레이)

<%= form_for([@project, @update], :url => profile_project_updates_path, :remote => true) do |f| %> 

제가

또한
<%= form_for([:profile, @project, @update], :remote => true) do |f| %> 

routes.rb

namespace :profile do 
    resources :projects, :only => [:show, :index, :edit] do 
    resources :updates 
    end 
end 
시도

누군가가 : remote => true를 얻는 방법을 알고 있다면 여기가 좋습니다!

지금까지 발견 한 모든 소중한 리소스에 대한 모든 스택 오버 플로우 커뮤니티 덕분입니다.

_Clement

답변

0

컨트롤러의 새 작업에서 @project를 초기화 했습니까?

시도 양식을 제출할 때

<%= form_for([@update.project_id, @update], :url => profile_project_updates_path, :remote => true) do |f| %> 

서버 응답은 무엇과

<%= form_for([@project, @update], :url => profile_project_updates_path, :remote => true) do |f| %> 

를 대체?

관련 문제