Class works in console but not in RoR debugger?

Hi,

My code works perfectly from the console but not via the debugging
console?
What could be the difference?
Any insights would be MUCH appreciated.

Thanks!!

Larry

console:
Loading development environment.

foo = ExtraClnyForm.new
=> #ExtraClnyForm:0xb77e22e4

foo.valid?
=> false

debugging console after a breakpoint in the controller:
Executing break point “start 1” at
/home/web/limmud_registration/secure/ror/public/…/config/…/app/controllers/clny_controller.rb:15
in new' irb(#<ClnyController:0xb7c2f6fc>):001:0> foo = ExtraClnyForm.new => #<ExtraClnyForm:0xb7b17230> irb(#<ClnyController:0xb7c2f6fc>):002:0> foo.valid? NoMethodError: undefined methodvalid?’ for #ExtraClnyForm:0xb7b17230
from (druby://localhost:42531) (irb):2:in breakpoint' from (druby://localhost:42531) /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/breakpoint.rb:512:inbreakpoint’

The class ExtraClnyForm is from recipe 64, Validating non-Active Record
Objects from the Rails Recipes books. – It’s a class with a mixin from
ActiveRecord::Validations

source:
models/extra_clny_form
class ExtraClnyForm
include Validateable

Additional fields used in the CLNY Enrollment Form

attr_accessor :parent # are you a parent or legal guardian?

validates_presence_of :parent
unless :parent?
errors.add_to_base(“Error msg goes here.”)
end
end

lib/validateable.rb – unchanged from the book’s code
module Validateable
[:save, :save!, :update_attribute].each{|attr| define_method(attr){}}
def method_missing(symbol, params)
if(symbol.to_s =~ /(.
)_before_type_cast$/)
send($1)
end
end
def self.append_features(base)
super
base.send(:include, ActiveRecord::Validations)
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs