模型属性未设置

发布于 2024-11-28 03:15:38 字数 1985 浏览 1 评论 0原文

下面的日志片段显示了传入的参数,但是当执行 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

The below log snippet shows the parameters that get passed in, but then when the SQL insert statement is made it inserts nulls for all the values instead of the values in params. Can you guys give me some ideas to debug this? I don't know where to start

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

Model:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

和我恋爱吧 2024-12-05 03:15:38

将 attr_accessor 更改为 attr_accessible

change attr_accessor to attr_accessible

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文