Answers.Body: <p>I might be wrong here, but I don't think a model can be used to save entries. You populate a model, then populate a record with that model and save it. Once saved, you get data from the db as a record, then populate a model with it to pass that to a view, for instance.</p>
  
  <p>If everything works as it should, a record is never used outside the service.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-01T14:15:49.967Z
Answers.Text: The underlying CActiveRecord class contains hasErrors and getErrors methods.
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-18T06:45:02.913Z
Answers.Text: Nailed it. In rare instances, you might modify a record's properties just before saving (or just after retrieving). But if that data ever leaves your service layer, it should do so as a model.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-18T14:56:59.337Z
Answers.Text: How does this work when updating an existing record? https://gist.github.com/russback/f6d96809a459e3872363 shows how I'm currently doing it but it feels a little odd to have to declare a model just to access the allErrors property (it doesn't exist on the BaseRecord class.
Answers.UserDisplayName: Russ Back
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-17T20:33:13.880Z
Answers.LastActivityDate: 2014-12-17T20:33:13.880Z
Answers.UserDisplayName: Paul
Body: <p>If a Model can be used to save entries, what is a Record for? Is it literally just to define the schema? I've seen a few examples where the defineAttributes methods have duplication of code too, so I'm a little confused...</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-18T02:53:58.710Z
Comments.Text: There is a good explanation of models vs. records in Craft here: http://craftcms.stackexchange.com/a/2973/57
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-18T09:53:54.497Z
Comments.Text: Thanks, Brad. I'd like to echo one of the comments on that article in that it would be great if this detail was in the docs.
Comments.UserDisplayName: Russ Back
Tags: <plugin-development><database><models><records>
Title: Models v Records - confused
ThreadText: # Models v Records - confused
  
  (Asked by: username_0 on 2014-12-17)
  
  If a Model can be used to save entries, what is a Record for? Is it literally just to define the schema? I've seen a few examples where the defineAttributes methods have duplication of code too, so I'm a little confused...
  
  **Tags:** plugin-development, database, models, records
  
  > **Comments:**
  > **username_1**: There is a good explanation of models vs. records in Craft here: http://craftcms.stackexchange.com/a/2973/57  
  > **username_0**: Thanks, username_1. I'd like to echo one of the comments on that article in that it would be great if this detail was in the docs.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-12-17. Score: 6 | Accepted answer
  
  I might be wrong here, but I don't think a model can be used to save entries. You populate a model, then populate a record with that model and save it. Once saved, you get data from the db as a record, then populate a model with it to pass that to a view, for instance.
  
  If everything works as it should, a record is never used outside the service.
  
  > **Comments:**
  > **username_4**: Nailed it. In rare instances, you might modify a record's properties just before saving (or just after retrieving). But if that data ever leaves your service layer, it should do so as a model.  
  > **username_0**: How does this work when updating an existing record? https://gist.github.com/username_0/f6d96809a459e3872363 shows how I'm currently doing it but it feels a little odd to have to declare a model just to access the allErrors property (it doesn't exist on the BaseRecord class.  
  > **username_3**: The underlying CActiveRecord class contains hasErrors and getErrors methods.  
  
  ---
  
  