From 02b16976291181d84ac7eb307a299f9263e1a3a0 Mon Sep 17 00:00:00 2001 From: Mark Cottman-Fields Date: Tue, 19 Feb 2013 10:27:54 +1000 Subject: [PATCH] Added a monkeypatch to get deleter_id to work. Fixed some failing tests. modified: app/models/project.rb modified: app/models/tag.rb new file: config/initializers/03_userstamp_monkeypatch.rb modified: config/initializers/secret_token.rb modified: db/schema.rb modified: spec/controllers/tags_controller_spec.rb modified: spec/factories/analysis_job_factory.rb --- app/models/project.rb | 5 ++++- app/models/tag.rb | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index b1ed71e8..4f6351e7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -13,7 +13,8 @@ class Project < ActiveRecord::Base # attr # http://stackoverflow.com/questions/4934194/resulttype-614051528-expected-got-string-608366078-with-many-to-many-as - attr_accessible :description, :name, :urn, :notes, :site_ids, :photos_attributes # :sites, :sites_attributes (those damn s's!) + attr_accessible :description, :name, :urn, :notes, :latitude, :longitude, + :site_ids, :photos_attributes # :sites, :sites_attributes (those damn s's!) # userstamp @@ -25,6 +26,8 @@ class Project < ActiveRecord::Base # validation validates :name, :presence => true, :uniqueness => { :case_sensitive => false } validates :urn, :presence => true, :uniqueness => { :case_sensitive => false } + validates :latitude, :numericality => true + validates :longitude, :numericality => true validates_format_of :urn, :with => /^urn:[a-z0-9][a-z0-9-]{0,31}:[a-z0-9()+,\-.:=@;$_!*'%\/?#]+$/ # commonly used queries (these return diff --git a/app/models/tag.rb b/app/models/tag.rb index 5c3a34bf..d80dbcf3 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -7,7 +7,7 @@ class Tag < ActiveRecord::Base accepts_nested_attributes_for :audio_events # attr - attr_accessible :is_taxanomic, :text, :type_of_tag + attr_accessible :is_taxanomic, :text, :type_of_tag, :retired, :notes # userstamp stampable @@ -21,6 +21,7 @@ class Tag < ActiveRecord::Base # validation validates :is_taxanomic, inclusion: { in: [true, false] } validates :text, uniqueness: { case_sensitive: false } + validates :retired, inclusion: { in: [true, false] } validate :no_nils