From 0b44f65514c60949856779c99ea7fcb5090f416e Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 6 Jan 2012 14:05:06 +0000 Subject: Return nil if there's no latest calculated state to return --- app/models/info_request_event.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/models') diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 4ea89bf81..3514702da 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -147,6 +147,7 @@ class InfoRequestEvent < ActiveRecord::Base return event.calculated_state end end + return end def waiting_classification -- cgit v1.2.3 From 5163ea88dc41a2c30dffeec62725878d540a6011 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Fri, 6 Jan 2012 20:50:38 +0100 Subject: Fix user profile validation errors not showing. Fixes #317 --- app/models/about_me_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb index ec2b03201..e24c5512c 100644 --- a/app/models/about_me_validator.rb +++ b/app/models/about_me_validator.rb @@ -21,7 +21,7 @@ class AboutMeValidator < ActiveRecord::BaseWithoutTable def validate if !self.about_me.blank? && self.about_me.size > 500 - errors.add(_("Please keep it shorter than 500 characters")) + errors.add(:about_me, _("Please keep it shorter than 500 characters")) end end -- cgit v1.2.3 From a5f6dc2d8af9a12c05c1b6e3897292f2eaee3ab0 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Sun, 8 Jan 2012 09:38:43 +0000 Subject: Don't give error when viewing HTML versions. Fixes issue #321 --- app/models/foi_attachment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb index 057dcdb69..16e202bee 100644 --- a/app/models/foi_attachment.rb +++ b/app/models/foi_attachment.rb @@ -19,7 +19,7 @@ class FoiAttachment < ActiveRecord::Base before_destroy :delete_cached_file! def directory - base_dir = File.join("cache", "attachments_#{ENV['RAILS_ENV']}") + base_dir = File.join(File.dirname(__FILE__), "../../cache", "attachments_#{ENV['RAILS_ENV']}") return File.join(base_dir, self.hexdigest[0..2]) end @@ -302,7 +302,7 @@ class FoiAttachment < ActiveRecord::Base body = $1.to_s body_without_tags = body.gsub(/\s+/,"").gsub(/\<[^\>]*\>/, "") contains_images = html.match(/