Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix use of deprecated Errors#on_base (#242)

  • Loading branch information...
commit 39c22b1a79b9f1823481c2f9f80e2161f172fadb 1 parent a722680
@yabawock yabawock authored
Showing with 8 additions and 7 deletions.
  1. +1 −0  CHANGELOG
  2. +1 −1  lib/formtastic.rb
  3. +6 −6 spec/semantic_errors_spec.rb
View
1  CHANGELOG
@@ -5,6 +5,7 @@
* Changed Rakefile to initalize the correct testing framework for the enviroment
* Fixed inputs_for_nested_attributes only appending to the output buffer
* Fixed use of model_name.human instead of model_name.human_name (rails3)
+* Fixed use of deprecated Errors#on_base
* Added railtie to perform initialization tasks after the rails git framework is available (rails3)
* Added helper to mark strings as HTML safe depending on environment, adapted from haml 2.2 solution (rails3)
* Added compatible install and form helpers (rails3)
View
2  lib/formtastic.rb
@@ -456,7 +456,7 @@ def semantic_errors(*args)
errors = Array(@object.errors[method.to_sym]).to_sentence
errors.present? ? array << [attribute, errors].join(" ") : array ||= []
end
- full_errors << @object.errors.on_base
+ full_errors << @object.errors[:base]
full_errors.flatten!
full_errors.compact!
return nil if full_errors.blank?
View
12 spec/semantic_errors_spec.rb
@@ -17,7 +17,7 @@
describe 'when there is only one error on base' do
before do
- @errors.stub!(:on_base).and_return(@base_error)
+ @errors.stub!(:[]).with(:base).and_return(@base_error)
end
it 'should render an unordered list' do
@@ -29,7 +29,7 @@
describe 'when there is more than one error on base' do
before do
- @errors.stub!(:on_base).and_return(@base_errors)
+ @errors.stub!(:[]).with(:base).and_return(@base_errors)
end
it 'should render an unordered list' do
@@ -45,7 +45,7 @@
describe 'when there are errors on title' do
before do
@errors.stub!(:[]).with(:title).and_return(@title_errors)
- @errors.stub!(:on_base).and_return([])
+ @errors.stub!(:[]).with(:base).and_return([])
end
it 'should render an unordered list' do
@@ -59,7 +59,7 @@
describe 'when there are errors on title and base' do
before do
@errors.stub!(:[]).with(:title).and_return(@title_errors)
- @errors.stub!(:on_base).and_return(@base_error)
+ @errors.stub!(:[]).with(:base).and_return(@base_error)
end
it 'should render an unordered list' do
@@ -74,7 +74,7 @@
describe 'when there are no errors' do
before do
@errors.stub!(:[]).with(:title).and_return(nil)
- @errors.stub!(:on_base).and_return(nil)
+ @errors.stub!(:[]).with(:base).and_return(nil)
end
it 'should return nil' do
@@ -86,7 +86,7 @@
describe 'when there is one error on base and options with class is passed' do
before do
- @errors.stub!(:on_base).and_return(@base_error)
+ @errors.stub!(:[]).with(:base).and_return(@base_error)
end
it 'should render an unordered list with given class' do
Please sign in to comment.
Something went wrong with that request. Please try again.