i'v been new to ruby and rails and encountered a rather strange error:
class Person < ActiveRecord::Base
validates_presence_of :description, :if => require_description_presence?
def require_description_presence?
self.can_send_email
end
end
raises
NoMethodError in PeopleController#index
undefined method `require_description_presence?' for #<Class:0x4c4fadc>
You should pass validation method as symbol:
validates_presence_of :description, :if => :require_description_presence?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With