未找到参数:发电机

时间:2013-12-11 15:02:17

标签: ruby-on-rails

我试图与第二个模型(生成器)一起构建我的第三个模型(结果)。我从我的Generator show.html.erb调用结果表单,当我单击表单中的提交按钮时,我收到此错误param not found: generator

的routes.rb

resources :users do
    resources :generators 
    resources :results
  end  

生成器show.html.erb

...
        <legend><strong>Binding Time Analysis</strong></legend>
    <%= render "results/form" %>
    </fieldset>
<% end %>

Result.controller

def new
    @result=Result.new
  end

  # GET /results/1/edit

  # POST /results
  # POST /results.json TGATGAACATCATGATGAGGTGATGACATCACATCATTGACTGATGCATCATGATG
  def create
    @result = @generator.build_result(result_params)
    @result=@result.generate_result(result_params)
    @generator.result.save
    redirect_to user_generators_path
  end

def result_params
      params.require(:result).permit(:ncbi_ref_seq,:genome_seq,:genome_sample,:binding_times,:amp_frags,:seqpos1,:seqpos2)
    end

User.rb

class User < ActiveRecord::Base
  has_many :generators
  has_many :results, :through=>:generators

Generator.rb

class Generator < ActiveRecord::Base
  has_one :result , :dependent => :destroy
  belongs_to :user
  attr_accessible :choice, :primer_length, :random_primer_generated, :generator_id

Result.rb

class Result < ActiveRecord::Base
   attr_accessible :generator_id,:ncbi_ref_seq,:genome_seq, :genome_sample
   belongs_to :generator

表格

<%= form_for(@generator.build_result,:url =>user_generator_path(:user_id => current_user.id, :id => @generator.id),:html =>{:method=>:put}) do |f| %>
  <%= text_field_tag(:ncbi_ref_seq ,nil, placeholder: 'Accession Number')%>
  </p>

  <p id="highlight"><font size ="5">
        OR  
  </font></p>

  <p id="FASTA">
    <strong><font size ="3">Paste your sequence here: ( FASTA format ) :</font></strong> 
    <%= text_area_tag(:genome_seq,nil,size: "50x10",placeholder: 'Input your sequence here')%>
 </p>

  <input type="reset" value="Reset" id="reset">
    <%= submit_tag 'Analyze' %>
<% end %>

Generator.controller generator_params

def generator_params
        params.require(:generator).permit(:generator_id,:primer_length,:choice,:random_primer_generated,:no_A,:no_T,:no_G,:no_C,:user_seq)
    end

0 个答案:

没有答案