0

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
bdeonovic
  • 4,130
  • 7
  • 40
  • 70

1 Answers1

2

change attr_accessor to attr_accessible

stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
  • 1
    I don't know how this fixes things. attr_accessible keyword is used to allow mass assignment on certain fields, I don't know how it is helpful here. Usually, attr_accessible keyword is enough. – rookieRailer Aug 05 '11 at 17:38
  • Are you using nifty:scaffold ? – rookieRailer Aug 05 '11 at 17:40
  • Im having other problems now see http://stackoverflow.com/questions/6959097/rails-attribute-set-correctly-in-console-but-not-in-view – bdeonovic Aug 05 '11 at 17:57