2010-06-29 79 views
0

我试图使用this example但它不起作用。 我想这是因为我使用浅层嵌套模型! 我得到这个错误:模板丢失Rails 3 CRUD浅层嵌套模型

Missing template pprojects/create with {:formats=>[:html], :handlers=>[:builder, :erb, :haml, :rjs, :rhtml, :rxml], :locale=>[:en, :en]} 

It looks like my app is trying to do HTML and no JS because my server console says the following: 

Processing by ProjectController#create as HTML 

也许我这里有一个问题:

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

,或者因为在我的控制我的加载方法不符合创建和更新兼容:

def load 
    @projects = Project.all 
    @project = Project.new 
    end 

def create 
    @project = @organization.projects.new(params[:project]) 
    if @project.save 
     flash[:notice] = "Successfully created project." 
     @projects = Project.all 
    end 
    end 

    def update 
    @project = Project.find(params[:id]) 
    if @project.update_attributes(params[:project]) 
     flash[:notice] = "Successfully updated project." 
     @projects = Project.all 
    end 

你有线索吗? 在此先感谢

回答

0

我敢打赌,你有你的javascript_include_tags以错误的方式

尽量把他们放在这样的:

// include jquery before you include rails.js file - it's very important!! 
javascript_include_tag 'path/to/jquery' 
javascript_include_tag 'path/to/rails' 

它为我工作。

+0

你好,感谢您的回复,但我的标签正在工作。 – Fabien 2010-07-28 09:01:35