markcatley-advanced_errors 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/init.rb +1 -1
- data/lib/advanced_errors.rb +1 -22
- data/test/full_message_test.rb +2 -1
- metadata +3 -3
data/init.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
rails/init.rb
|
data/lib/advanced_errors.rb
CHANGED
@@ -1,25 +1,4 @@
|
|
1
|
-
|
2
|
-
module AdvancedErrors
|
3
|
-
module FullMessages
|
4
|
-
def full_messages_with_ignore_attribute
|
5
|
-
error = ActiveRecord::Errors.new @base
|
6
|
-
self.each do |attribute, message|
|
7
|
-
unless message.match(/^\^/)
|
8
|
-
error.add attribute, message
|
9
|
-
else
|
10
|
-
error.add_to_base message[1..message.length] #Adding to base will mean that the attribute will not be displayed
|
11
|
-
end
|
12
|
-
end
|
13
|
-
error.full_messages_without_ignore_attribute
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.included(base)
|
17
|
-
base.class_eval { alias_method :full_messages_without_ignore_attribute, :full_messages }
|
18
|
-
base.class_eval { alias_method :full_messages, :full_messages_with_ignore_attribute }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
1
|
+
require 'advanced_errors/full_messages'
|
23
2
|
|
24
3
|
if defined?(Rails) and defined?(ActiveRecord)
|
25
4
|
ActiveRecord::Errors.send :include, Nexx::AdvancedErrors::FullMessages
|
data/test/full_message_test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test/unit'
|
2
|
+
require File.dirname(__FILE__) + File::SEPARATOR + 'test_helper'
|
2
3
|
|
3
4
|
class AdvancedErrorsTest < Test::Unit::TestCase
|
4
5
|
def test_should_render_errors
|
@@ -12,4 +13,4 @@ class AdvancedErrorsTest < Test::Unit::TestCase
|
|
12
13
|
def should_not_change_errors
|
13
14
|
|
14
15
|
end
|
15
|
-
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markcatley-advanced_errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Catley
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-07-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements: []
|
59
59
|
|
60
60
|
rubyforge_project:
|
61
|
-
rubygems_version: 1.0
|
61
|
+
rubygems_version: 1.2.0
|
62
62
|
signing_key:
|
63
63
|
specification_version: 2
|
64
64
|
summary: "[Rails] Extentions to ActiveRecord's error handling features which I find useful."
|