Skip to content

Commit

Permalink
Add record validation in PhenotypeSnp model
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Rai <vivekrai.iitkgp@gmail.com>
  • Loading branch information
raivivek committed Aug 7, 2016
1 parent 7fbf700 commit 4174d56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/models/phenotype_snp.rb
Expand Up @@ -4,6 +4,9 @@ class PhenotypeSnp < ActiveRecord::Base
belongs_to :snp
belongs_to :phenotype

validates :snp, :presence => true
validates :phenotype, :presence => true

def self.update_phenotypes
max_age = 30.days.ago

Expand Down
4 changes: 2 additions & 2 deletions db/structure.sql
Expand Up @@ -680,7 +680,7 @@ CREATE TABLE phenotype_snps (
id integer NOT NULL,
snp_id integer,
phenotype_id integer,
score double precision,
score double precision DEFAULT 0.0,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
Expand Down Expand Up @@ -966,7 +966,7 @@ C: 0
created_at timestamp without time zone,
updated_at timestamp without time zone,
user_snps_count integer,
phenotype_updated timestamp without time zone DEFAULT '2016-07-03 07:11:29.671457'::timestamp without time zone
phenotype_updated timestamp without time zone DEFAULT '2016-07-03 09:56:16.027106'::timestamp without time zone
);


Expand Down

0 comments on commit 4174d56

Please sign in to comment.