未设置模型属性

时间:2011-08-05 13:46:42

标签: ruby-on-rails model controller

下面的日志片段显示了传入的参数,但是当插入SQL语句时,它会为所有值而不是params中的值插入空值。你们能给我一些想法来调试吗?我不知道从哪里开始

Processing by CvitsController#create as HTML
  Parameters: {"commit"=>"Submit", "authenticity_token"=>"uRicLgLLkzSSB62b/bqefI0tQ2lR6UX8axKWBtM0dsU=", "utf8"=>"✓", "cvit"=>{"cluster_dist"=>"10000", "textup"=>">Glyma02g37330 RING finger family [Glycine max]\r\nMNMHKESPLIKLHSFDQGHAWLALLHLLIHVSPAVTGQPVTPPVQPDSNKSMVTIMAILAIMFLILVFLSIYSRKCYDRQAPTRGILDRADPTG\r\nAAGNPSQAESNGLNQATIETFPSFLYGDVKGLKIGKDTLACAVCLNEFEDDETLRMIPKCCHVYHRYCIDEWLGSHSTCPVCRANLVPQPED\r\nVNINTNIPSILSIQIPDEHEHEYEYETVVVGEEHKRGNVVESPKVNLLRRIRSLNHQSRPSRSRSTGFLSSLLFSRSNSLGQMQLAHNAAGENYE\r\nRFTLRLPEEVRSQMMLQRANSCVCFTRMSSGTWGYRTTRSAGRRCVQYERFGGGDDEGWGFTLTPPSLIRNGWNNNRSTRKSQRSGLVLD\r\nNNNADEKSSEFLPLG*", "filter"=>"T", "min_identity"=>"60", "e_value"=>"1e-10", "program"=>"blastp", "species"=>"glycine_max"}}
Creating scope :page. Overwriting existing method Cvit.page.
  SQL (0.1ms)  BEGIN
  SQL (1.6ms)  describe `cvits`
  AREL (0.3ms)  INSERT INTO `cvits` (`cluster_dist`, `fileup_file_size`, `textup`, `fileup_file_name`, `filter`, `created_at`, `program`, `fileup_updated_at`, `species`, `min_identity`, `updated_at`, `e_value`, `fileup_content_type`) VALUES (NULL, NULL, NULL, NULL, NULL, '2011-08-05 13:50:07', NULL, NULL, NULL, NULL, '2011-08-05 13:50:07', NULL, NULL)
[paperclip] Saving attachments.
  SQL (121.3ms)  COMMIT
Redirected to http://soybase.org:8085/cvits/4
Completed 302 Found in 150ms

型号:

class Cvit < ActiveRecord::Base
  attr_accessor :species,:program,:textup,:e_value,:filter,:min_identity,:cluster_dist,:fileup_file_name
  attr_accessor :base_path, :fa_file, :text_file, :dbase, :source, :bl_file, :bl_sorted, :gff_file, :cvt_file, :db, :overlay_coords_gray

  def initilize(*args)
     super(*args)
  end

  def cvitSetup()
    .
    .
    .
  end
  def blast()
    .
    .
    .
  end
    .
    .
    .
end

1 个答案:

答案 0 :(得分:2)

将attr_accessor更改为attr_accessible