Tuesday, August 17, 2010

[Rails] Re: First Test Failures: Anything Obvious?

Terry Michaels wrote:
> # cat app/models/recording.rb
> class Recording < ActiveRecord::Base
> validate :title, :speaker, :date_of_event, :file, :presence => true
> validate :title, :file, :uniqueness => true
> end

Wait, double checked the book... the method is supposed to be
"validates", not "validate".

Problem solved? Unfortunately, not quite. New unit test run gives me:

/usr/bin/ruby -I"lib:test"
"/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
"test/unit/helpers/home_helper_test.rb"
"test/unit/helpers/recordings_helper_test.rb"
"test/unit/recording_test.rb"
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1959:in
`method_missing': undefined method `validates' for
#<Class:0x7fefd5c73478> (NoMethodError)
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate