Validating without saving


#1

i am trying to validate without saving use the valid? method on my
object. however i keep getting the following error (that i reproduced
in console) “NoMethodError for field”

Any ideas ?

thanks
adam

Loading development environment.

p = Post.new
=> #<Post:0x407b6050 @attributes={“created_on”=>nil, “subcat”=>1,
“cat”=>nil, “body”=>"", “zipcode”=>0, “subject”=>"", “contactok”=>“0”,
“views”=>0, “user_id”=>0, “image”=>nil, “email”=>nil},
@new_record=true>

p.valid?
NoMethodError: undefined method field' for #<Post:0x407b6050> from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1501:inmethod_missing’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:294:in
send' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:294:invalidates_each’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:293:in
each' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:293:invalidates_each’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:290:in
call' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:769:inrun_validations’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:763:in
each' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:763:inrun_validations’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/validations.rb:727:in
valid_without_callbacks' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/callbacks.rb:306:invalid?’
from (irb):2


#2

disregard, i left :field in my model by accident and it was
complaingin on that…

sorry