On Nov 12, 12:36 pm, icke <[email protected]> wrote: > > /Users/owain/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/active_record/ > attribute_methods.rb:255:in `method_missing' > /Users/owain/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/active_record/ > validations.rb:1019:in `send' > /Users/owain/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/active_record/ > validations.rb:1019:in `validates_numericality_of_without_reflection' > > which I suspect is that this type of validation will not work with > virtual attributes. Is this the case???
That error is getting raised because the validation is trying to call attribute_name_before_type_cast If you implement that method it might just work. Fred > > Is the approach below the best solution or even work? > > validate :custom_validation > > def custom_validation > errors.add(:dd_account, "Some error message") if detect_something > end > > Additionally, can you use the class methods in custom methods? I > would like to use validates_length_of etc if I go down the custom > method route. Again, if I do manage to use them will they work on > virtual attributes? > > Thanks, > > O. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

