Quoting Learn By Doing <[email protected]>: > > Hi Colin, > > After reading the API, I think that > > validates_presence_of :user_id > > will not even check to make sure that the user exists in the user > table. It only makes sure that the field value is not blank: > http://apidock.com/rails/ActiveRecord/Validations/ClassMethods/validates_presence_of. > > So this validation does not do the work of a proper foreign key > constraint. Am I reading the API incorrectly? >
Yes, there is another validation to verify that the associated object exists and is valid, validates_associated. HTH, Jeffrey --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

