sproutcore 1.6.0.rc.2-x86-mingw32 → 1.6.0.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +12 -0
 - data/VERSION.yml +1 -1
 - data/bin/sc-docs +6 -1
 - data/lib/buildtasks/target.rake +1 -1
 - data/lib/frameworks/sproutcore/Buildfile +5 -1
 - data/lib/frameworks/sproutcore/CHANGELOG.md +175 -1
 - data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
 - data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
 - data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +28 -31
 - data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +9 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +6 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +26 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +12 -5
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +25 -9
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +9 -3
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +104 -4
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +4 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +10 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +18 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +9 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +9 -4
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +15 -3
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +14 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
 - data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
 - data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +22 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +14 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +61 -46
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
 - data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +4 -63
 - data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +7 -8
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +18 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +1 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +33 -22
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +10 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +40 -14
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +699 -700
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
 - data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +80 -110
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -17
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +35 -8
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +6 -6
 - data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +0 -5
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +6 -9
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
 - data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +25 -14
 - data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -9
 - data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +19 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +3 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
 - data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +9 -2
 - data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +3 -1
 - data/lib/frameworks/sproutcore/frameworks/testing/resources/runner.css +0 -1
 - data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
 - data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +0 -4
 - data/lib/frameworks/sproutcore/lib/index.rhtml +2 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +3 -3
 - data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
 - data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
 - data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
 - data/lib/sproutcore/builders/base.rb +5 -1
 - data/lib/sproutcore/builders/handlebars.rb +12 -1
 - data/lib/sproutcore/models/target.rb +1 -9
 - data/lib/sproutcore/rack/proxy.rb +238 -92
 - data/lib/sproutcore/tools/docs.rb +1 -7
 - data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
 - data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
 - data/spec/lib/builders/handlebars_spec.rb +10 -4
 - data/sproutcore.gemspec +3 -1
 - metadata +73 -44
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
 
| 
         @@ -10,27 +10,27 @@ sc_require('system/query'); 
     | 
|
| 
       10 
10 
     | 
    
         
             
            /**
         
     | 
| 
       11 
11 
     | 
    
         
             
              @class
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
              A Record is the core model class in SproutCore. It is analogous to 
     | 
| 
      
 13 
     | 
    
         
            +
              A Record is the core model class in SproutCore. It is analogous to
         
     | 
| 
       14 
14 
     | 
    
         
             
              NSManagedObject in Core Data and EOEnterpriseObject in the Enterprise
         
     | 
| 
       15 
15 
     | 
    
         
             
              Objects Framework (aka WebObjects), or ActiveRecord::Base in Rails.
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       17 
17 
     | 
    
         
             
              To create a new model class, in your SproutCore workspace, do:
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       19 
19 
     | 
    
         
             
                  $ sc-gen model MyApp.MyModel
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       21 
21 
     | 
    
         
             
              This will create MyApp.MyModel in clients/my_app/models/my_model.js.
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              The core attributes hash is used to store the values of a record in a 
     | 
| 
       24 
     | 
    
         
            -
              format that can be easily passed to/from the server.  The values should 
     | 
| 
       25 
     | 
    
         
            -
              generally be stored in their raw string form.  References to external 
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              The core attributes hash is used to store the values of a record in a
         
     | 
| 
      
 24 
     | 
    
         
            +
              format that can be easily passed to/from the server.  The values should
         
     | 
| 
      
 25 
     | 
    
         
            +
              generally be stored in their raw string form.  References to external
         
     | 
| 
       26 
26 
     | 
    
         
             
              records should be stored as primary keys.
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              Normally you do not need to work with the attributes hash directly. 
     | 
| 
       29 
     | 
    
         
            -
              Instead you should use get/set on normal record properties.  If the 
     | 
| 
       30 
     | 
    
         
            -
              property is not defined on the object, then the record will check the 
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              Normally you do not need to work with the attributes hash directly.
         
     | 
| 
      
 29 
     | 
    
         
            +
              Instead you should use get/set on normal record properties.  If the
         
     | 
| 
      
 30 
     | 
    
         
            +
              property is not defined on the object, then the record will check the
         
     | 
| 
       31 
31 
     | 
    
         
             
              attributes hash instead.
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
              You can bulk update attributes from the server using the 
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              You can bulk update attributes from the server using the
         
     | 
| 
       34 
34 
     | 
    
         
             
              `updateAttributes()` method.
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
              @extends SC.Object
         
     | 
| 
         @@ -39,42 +39,42 @@ sc_require('system/query'); 
     | 
|
| 
       39 
39 
     | 
    
         
             
            */
         
     | 
| 
       40 
40 
     | 
    
         
             
            SC.Record = SC.Object.extend(
         
     | 
| 
       41 
41 
     | 
    
         
             
            /** @scope SC.Record.prototype */ {
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
              /** 
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              /**
         
     | 
| 
       44 
44 
     | 
    
         
             
                Walk like a duck
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       46 
46 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       47 
47 
     | 
    
         
             
                @default YES
         
     | 
| 
       48 
48 
     | 
    
         
             
              */
         
     | 
| 
       49 
49 
     | 
    
         
             
              isRecord: YES,
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
       51 
51 
     | 
    
         
             
              /**
         
     | 
| 
       52 
52 
     | 
    
         
             
                If you have nested records
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
       54 
54 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       55 
55 
     | 
    
         
             
                @default NO
         
     | 
| 
       56 
56 
     | 
    
         
             
              */
         
     | 
| 
       57 
57 
     | 
    
         
             
              isParentRecord: NO,
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
       59 
59 
     | 
    
         
             
              // ...............................
         
     | 
| 
       60 
60 
     | 
    
         
             
              // PROPERTIES
         
     | 
| 
       61 
61 
     | 
    
         
             
              //
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
       63 
63 
     | 
    
         
             
              /**
         
     | 
| 
       64 
64 
     | 
    
         
             
                This is the primary key used to distinguish records.  If the keys
         
     | 
| 
       65 
65 
     | 
    
         
             
                match, the records are assumed to be identical.
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
       67 
67 
     | 
    
         
             
                @type String
         
     | 
| 
       68 
68 
     | 
    
         
             
                @default 'guid'
         
     | 
| 
       69 
69 
     | 
    
         
             
              */
         
     | 
| 
       70 
70 
     | 
    
         
             
              primaryKey: 'guid',
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
       72 
72 
     | 
    
         
             
              /**
         
     | 
| 
       73 
     | 
    
         
            -
                Returns the id for the record instance.  The id is used to uniquely 
     | 
| 
       74 
     | 
    
         
            -
                identify this record instance from all others of the same type.  If you 
     | 
| 
      
 73 
     | 
    
         
            +
                Returns the id for the record instance.  The id is used to uniquely
         
     | 
| 
      
 74 
     | 
    
         
            +
                identify this record instance from all others of the same type.  If you
         
     | 
| 
       75 
75 
     | 
    
         
             
                have a `primaryKey set on this class, then the id will be the value of the
         
     | 
| 
       76 
76 
     | 
    
         
             
                `primaryKey` property on the underlying JSON hash.
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
       78 
78 
     | 
    
         
             
                @type String
         
     | 
| 
       79 
79 
     | 
    
         
             
                @property
         
     | 
| 
       80 
80 
     | 
    
         
             
                @dependsOn storeKey
         
     | 
| 
         @@ -87,21 +87,21 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       87 
87 
     | 
    
         
             
                  return SC.Store.idFor(this.storeKey);
         
     | 
| 
       88 
88 
     | 
    
         
             
                }
         
     | 
| 
       89 
89 
     | 
    
         
             
              }.property('storeKey').cacheable(),
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
       91 
91 
     | 
    
         
             
              /**
         
     | 
| 
       92 
     | 
    
         
            -
                All records generally have a life cycle as they are created or loaded into 
     | 
| 
       93 
     | 
    
         
            -
                memory, modified, committed and finally destroyed.  This life cycle is 
     | 
| 
       94 
     | 
    
         
            -
                managed by the status property on your record. 
     | 
| 
      
 92 
     | 
    
         
            +
                All records generally have a life cycle as they are created or loaded into
         
     | 
| 
      
 93 
     | 
    
         
            +
                memory, modified, committed and finally destroyed.  This life cycle is
         
     | 
| 
      
 94 
     | 
    
         
            +
                managed by the status property on your record.
         
     | 
| 
       95 
95 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
                The status of a record is modelled as a finite state machine.  Based on the 
     | 
| 
       97 
     | 
    
         
            -
                current state of the record, you can determine which operations are 
     | 
| 
      
 96 
     | 
    
         
            +
                The status of a record is modelled as a finite state machine.  Based on the
         
     | 
| 
      
 97 
     | 
    
         
            +
                current state of the record, you can determine which operations are
         
     | 
| 
       98 
98 
     | 
    
         
             
                currently allowed on the record and which are not.
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
       100 
100 
     | 
    
         
             
                In general, a record can be in one of five primary states:
         
     | 
| 
       101 
101 
     | 
    
         
             
                `SC.Record.EMPTY`, `SC.Record.BUSY`, `SC.Record.READY`,
         
     | 
| 
       102 
102 
     | 
    
         
             
                `SC.Record.DESTROYED`, `SC.Record.ERROR`.  These are all described in
         
     | 
| 
       103 
103 
     | 
    
         
             
                more detail in the class mixin (below) where they are defined.
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
       105 
105 
     | 
    
         
             
                @type Number
         
     | 
| 
       106 
106 
     | 
    
         
             
                @property
         
     | 
| 
       107 
107 
     | 
    
         
             
                @dependsOn storeKey
         
     | 
| 
         @@ -113,47 +113,47 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       113 
113 
     | 
    
         
             
              /**
         
     | 
| 
       114 
114 
     | 
    
         
             
                The store that owns this record.  All changes will be buffered into this
         
     | 
| 
       115 
115 
     | 
    
         
             
                store and committed to the rest of the store chain through here.
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
       117 
117 
     | 
    
         
             
                This property is set when the record instance is created and should not be
         
     | 
| 
       118 
118 
     | 
    
         
             
                changed or else it will break the record behavior.
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
       120 
120 
     | 
    
         
             
                @type SC.Store
         
     | 
| 
       121 
121 
     | 
    
         
             
                @default null
         
     | 
| 
       122 
122 
     | 
    
         
             
              */
         
     | 
| 
       123 
123 
     | 
    
         
             
              store: null,
         
     | 
| 
       124 
124 
     | 
    
         | 
| 
       125 
125 
     | 
    
         
             
              /**
         
     | 
| 
       126 
     | 
    
         
            -
                This is the store key for the record, it is used to link it back to the 
     | 
| 
      
 126 
     | 
    
         
            +
                This is the store key for the record, it is used to link it back to the
         
     | 
| 
       127 
127 
     | 
    
         
             
                dataHash. If a record is reused, this value will be replaced.
         
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
       129 
129 
     | 
    
         
             
                You should not edit this store key but you may sometimes need to refer to
         
     | 
| 
       130 
130 
     | 
    
         
             
                this store key when implementing a Server object.
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
       132 
132 
     | 
    
         
             
                @type Number
         
     | 
| 
       133 
133 
     | 
    
         
             
                @default null
         
     | 
| 
       134 
134 
     | 
    
         
             
              */
         
     | 
| 
       135 
135 
     | 
    
         
             
              storeKey: null,
         
     | 
| 
       136 
136 
     | 
    
         | 
| 
       137 
     | 
    
         
            -
              /** 
     | 
| 
      
 137 
     | 
    
         
            +
              /**
         
     | 
| 
       138 
138 
     | 
    
         
             
                YES when the record has been destroyed
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
       140 
140 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       141 
141 
     | 
    
         
             
                @property
         
     | 
| 
       142 
142 
     | 
    
         
             
                @dependsOn status
         
     | 
| 
       143 
143 
     | 
    
         
             
              */
         
     | 
| 
       144 
144 
     | 
    
         
             
              isDestroyed: function() {
         
     | 
| 
       145 
     | 
    
         
            -
                return !!(this.get('status') & SC.Record.DESTROYED); 
     | 
| 
      
 145 
     | 
    
         
            +
                return !!(this.get('status') & SC.Record.DESTROYED);
         
     | 
| 
       146 
146 
     | 
    
         
             
              }.property('status').cacheable(),
         
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
       148 
148 
     | 
    
         
             
              /**
         
     | 
| 
       149 
149 
     | 
    
         
             
                `YES` when the record is in an editable state.  You can use this property to
         
     | 
| 
       150 
     | 
    
         
            -
                quickly determine whether attempting to modify the record would raise an 
     | 
| 
      
 150 
     | 
    
         
            +
                quickly determine whether attempting to modify the record would raise an
         
     | 
| 
       151 
151 
     | 
    
         
             
                exception or not.
         
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                This property is both readable and writable.  Note however that if you 
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                This property is both readable and writable.  Note however that if you
         
     | 
| 
       154 
154 
     | 
    
         
             
                set this property to `YES` but the status of the record is anything but
         
     | 
| 
       155 
155 
     | 
    
         
             
                `SC.Record.READY`, the return value of this property may remain `NO`.
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
       157 
157 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       158 
158 
     | 
    
         
             
                @property
         
     | 
| 
       159 
159 
     | 
    
         
             
                @dependsOn status
         
     | 
| 
         @@ -166,49 +166,49 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       166 
166 
     | 
    
         | 
| 
       167 
167 
     | 
    
         
             
              /**
         
     | 
| 
       168 
168 
     | 
    
         
             
                @private
         
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
       170 
170 
     | 
    
         
             
                Backing value for isEditable
         
     | 
| 
       171 
171 
     | 
    
         
             
              */
         
     | 
| 
       172 
172 
     | 
    
         
             
              _screc_isEditable: YES, // default
         
     | 
| 
       173 
173 
     | 
    
         | 
| 
       174 
174 
     | 
    
         
             
              /**
         
     | 
| 
       175 
     | 
    
         
            -
                `YES` when the record's contents have been loaded for the first time.  You 
     | 
| 
      
 175 
     | 
    
         
            +
                `YES` when the record's contents have been loaded for the first time.  You
         
     | 
| 
       176 
176 
     | 
    
         
             
                can use this to quickly determine if the record is ready to display.
         
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
       178 
178 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       179 
179 
     | 
    
         
             
                @property
         
     | 
| 
       180 
180 
     | 
    
         
             
                @dependsOn status
         
     | 
| 
       181 
181 
     | 
    
         
             
              */
         
     | 
| 
       182 
182 
     | 
    
         
             
              isLoaded: function() {
         
     | 
| 
       183 
     | 
    
         
            -
                var K = SC.Record, 
     | 
| 
      
 183 
     | 
    
         
            +
                var K = SC.Record,
         
     | 
| 
       184 
184 
     | 
    
         
             
                    status = this.get('status');
         
     | 
| 
       185 
185 
     | 
    
         
             
                return !((status===K.EMPTY) || (status===K.BUSY_LOADING) || (status===K.ERROR));
         
     | 
| 
       186 
186 
     | 
    
         
             
              }.property('status').cacheable(),
         
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
       188 
188 
     | 
    
         
             
              /**
         
     | 
| 
       189 
189 
     | 
    
         
             
                If set, this should be an array of active relationship objects that need
         
     | 
| 
       190 
     | 
    
         
            -
                to be notified whenever the underlying record properties change. 
     | 
| 
       191 
     | 
    
         
            -
                Currently this is only used by toMany relationships, but you could 
     | 
| 
       192 
     | 
    
         
            -
                possibly patch into this yourself also if you are building your own 
     | 
| 
      
 190 
     | 
    
         
            +
                to be notified whenever the underlying record properties change.
         
     | 
| 
      
 191 
     | 
    
         
            +
                Currently this is only used by toMany relationships, but you could
         
     | 
| 
      
 192 
     | 
    
         
            +
                possibly patch into this yourself also if you are building your own
         
     | 
| 
       193 
193 
     | 
    
         
             
                relationships.
         
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
       195 
195 
     | 
    
         
             
                Note this must be a regular Array - NOT any object implementing SC.Array.
         
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
       197 
197 
     | 
    
         
             
                @type Array
         
     | 
| 
       198 
198 
     | 
    
         
             
                @default null
         
     | 
| 
       199 
199 
     | 
    
         
             
              */
         
     | 
| 
       200 
200 
     | 
    
         
             
              relationships: null,
         
     | 
| 
       201 
201 
     | 
    
         | 
| 
       202 
202 
     | 
    
         
             
              /**
         
     | 
| 
       203 
     | 
    
         
            -
                This will return the raw attributes that you can edit directly.  If you 
     | 
| 
      
 203 
     | 
    
         
            +
                This will return the raw attributes that you can edit directly.  If you
         
     | 
| 
       204 
204 
     | 
    
         
             
                make changes to this hash, be sure to call `beginEditing()` before you get
         
     | 
| 
       205 
205 
     | 
    
         
             
                the attributes and `endEditing()` afterwards.
         
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
       207 
207 
     | 
    
         
             
                @type Hash
         
     | 
| 
       208 
208 
     | 
    
         
             
                @property
         
     | 
| 
       209 
209 
     | 
    
         
             
              **/
         
     | 
| 
       210 
210 
     | 
    
         
             
              attributes: function() {
         
     | 
| 
       211 
     | 
    
         
            -
                var store    = this.get('store'), 
     | 
| 
      
 211 
     | 
    
         
            +
                var store    = this.get('store'),
         
     | 
| 
       212 
212 
     | 
    
         
             
                    storeKey = this.storeKey;
         
     | 
| 
       213 
213 
     | 
    
         
             
                return store.readEditableDataHash(storeKey);
         
     | 
| 
       214 
214 
     | 
    
         
             
              }.property(),
         
     | 
| 
         @@ -218,31 +218,31 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       218 
218 
     | 
    
         
             
                useful if you want to efficiently look at multiple attributes in bulk.  If
         
     | 
| 
       219 
219 
     | 
    
         
             
                you would like to edit the attributes, see the `attributes` property
         
     | 
| 
       220 
220 
     | 
    
         
             
                instead.
         
     | 
| 
       221 
     | 
    
         
            -
             
     | 
| 
      
 221 
     | 
    
         
            +
             
     | 
| 
       222 
222 
     | 
    
         
             
                @type Hash
         
     | 
| 
       223 
223 
     | 
    
         
             
                @property
         
     | 
| 
       224 
224 
     | 
    
         
             
              **/
         
     | 
| 
       225 
225 
     | 
    
         
             
              readOnlyAttributes: function() {
         
     | 
| 
       226 
     | 
    
         
            -
                var store    = this.get('store'), 
     | 
| 
      
 226 
     | 
    
         
            +
                var store    = this.get('store'),
         
     | 
| 
       227 
227 
     | 
    
         
             
                    storeKey = this.storeKey,
         
     | 
| 
       228 
228 
     | 
    
         
             
                    ret      = store.readDataHash(storeKey);
         
     | 
| 
       229 
     | 
    
         
            -
             
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
       230 
230 
     | 
    
         
             
                if (ret) ret = SC.clone(ret, YES);
         
     | 
| 
       231 
231 
     | 
    
         | 
| 
       232 
232 
     | 
    
         
             
                return ret;
         
     | 
| 
       233 
233 
     | 
    
         
             
              }.property(),
         
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
       235 
235 
     | 
    
         
             
              /**
         
     | 
| 
       236 
236 
     | 
    
         
             
                The namespace which to retrieve the childRecord Types from
         
     | 
| 
       237 
     | 
    
         
            -
             
     | 
| 
      
 237 
     | 
    
         
            +
             
     | 
| 
       238 
238 
     | 
    
         
             
                @type String
         
     | 
| 
       239 
239 
     | 
    
         
             
                @default null
         
     | 
| 
       240 
240 
     | 
    
         
             
              */
         
     | 
| 
       241 
241 
     | 
    
         
             
              nestedRecordNamespace: null,
         
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
       243 
243 
     | 
    
         
             
              /**
         
     | 
| 
       244 
244 
     | 
    
         
             
                Whether or not this is a nested Record.
         
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
      
 245 
     | 
    
         
            +
             
     | 
| 
       246 
246 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       247 
247 
     | 
    
         
             
                @property
         
     | 
| 
       248 
248 
     | 
    
         
             
              */
         
     | 
| 
         @@ -250,14 +250,14 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       250 
250 
     | 
    
         
             
                var store = this.get('store'), ret,
         
     | 
| 
       251 
251 
     | 
    
         
             
                    sk = this.get('storeKey'),
         
     | 
| 
       252 
252 
     | 
    
         
             
                    prKey = store.parentStoreKeyExists(sk);
         
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
       254 
254 
     | 
    
         
             
                ret = prKey ? YES : NO;
         
     | 
| 
       255 
255 
     | 
    
         
             
                return ret;
         
     | 
| 
       256 
256 
     | 
    
         
             
              }.property().cacheable(),
         
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
       258 
258 
     | 
    
         
             
              /**
         
     | 
| 
       259 
259 
     | 
    
         
             
                The parent record if this is a nested record.
         
     | 
| 
       260 
     | 
    
         
            -
             
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
| 
       261 
261 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       262 
262 
     | 
    
         
             
                @property
         
     | 
| 
       263 
263 
     | 
    
         
             
              */
         
     | 
| 
         @@ -265,24 +265,24 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       265 
265 
     | 
    
         
             
                var sk = this.storeKey, store = this.get('store');
         
     | 
| 
       266 
266 
     | 
    
         
             
                return store.materializeParentRecord(sk);
         
     | 
| 
       267 
267 
     | 
    
         
             
              }.property(),
         
     | 
| 
       268 
     | 
    
         
            -
             
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
       269 
269 
     | 
    
         
             
              // ...............................
         
     | 
| 
       270 
270 
     | 
    
         
             
              // CRUD OPERATIONS
         
     | 
| 
       271 
271 
     | 
    
         
             
              //
         
     | 
| 
       272 
272 
     | 
    
         | 
| 
       273 
273 
     | 
    
         
             
              /**
         
     | 
| 
       274 
     | 
    
         
            -
                Refresh the record from the persistent store.  If the record was loaded 
     | 
| 
       275 
     | 
    
         
            -
                from a persistent store, then the store will be asked to reload the 
     | 
| 
       276 
     | 
    
         
            -
                record data from the server.  If the record is new and exists only in 
     | 
| 
      
 274 
     | 
    
         
            +
                Refresh the record from the persistent store.  If the record was loaded
         
     | 
| 
      
 275 
     | 
    
         
            +
                from a persistent store, then the store will be asked to reload the
         
     | 
| 
      
 276 
     | 
    
         
            +
                record data from the server.  If the record is new and exists only in
         
     | 
| 
       277 
277 
     | 
    
         
             
                memory then this call will have no effect.
         
     | 
| 
       278 
     | 
    
         
            -
             
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
       279 
279 
     | 
    
         
             
                @param {boolean} recordOnly optional param if you want to only THIS record
         
     | 
| 
       280 
280 
     | 
    
         
             
                  even if it is a child record.
         
     | 
| 
       281 
281 
     | 
    
         
             
                @param {Function} callback optional callback that will fire when request finishes
         
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
      
 282 
     | 
    
         
            +
             
     | 
| 
       283 
283 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
       284 
284 
     | 
    
         
             
              */
         
     | 
| 
       285 
     | 
    
         
            -
              refresh: function(recordOnly, callback) { 
     | 
| 
      
 285 
     | 
    
         
            +
              refresh: function(recordOnly, callback) {
         
     | 
| 
       286 
286 
     | 
    
         
             
                var store = this.get('store'), rec, ro,
         
     | 
| 
       287 
287 
     | 
    
         
             
                    sk = this.get('storeKey'),
         
     | 
| 
       288 
288 
     | 
    
         
             
                    prKey = store.parentStoreKeyExists();
         
     | 
| 
         @@ -299,19 +299,19 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       299 
299 
     | 
    
         | 
| 
       300 
300 
     | 
    
         
             
                return this ;
         
     | 
| 
       301 
301 
     | 
    
         
             
              },
         
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
       303 
303 
     | 
    
         
             
              /**
         
     | 
| 
       304 
     | 
    
         
            -
                Deletes the record along with any dependent records.  This will mark the 
     | 
| 
       305 
     | 
    
         
            -
                records destroyed in the store as well as changing the isDestroyed 
     | 
| 
       306 
     | 
    
         
            -
                property on the record to YES.  If this is a new record, this will avoid 
     | 
| 
      
 304 
     | 
    
         
            +
                Deletes the record along with any dependent records.  This will mark the
         
     | 
| 
      
 305 
     | 
    
         
            +
                records destroyed in the store as well as changing the isDestroyed
         
     | 
| 
      
 306 
     | 
    
         
            +
                property on the record to YES.  If this is a new record, this will avoid
         
     | 
| 
       307 
307 
     | 
    
         
             
                creating the record in the first place.
         
     | 
| 
       308 
308 
     | 
    
         | 
| 
       309 
309 
     | 
    
         
             
                @param {boolean} recordOnly optional param if you want to only THIS record
         
     | 
| 
       310 
     | 
    
         
            -
                  even if it is a child record. 
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
      
 310 
     | 
    
         
            +
                  even if it is a child record.
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
       312 
312 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
       313 
313 
     | 
    
         
             
              */
         
     | 
| 
       314 
     | 
    
         
            -
              destroy: function(recordOnly) { 
     | 
| 
      
 314 
     | 
    
         
            +
              destroy: function(recordOnly) {
         
     | 
| 
       315 
315 
     | 
    
         
             
                var store = this.get('store'), rec, ro,
         
     | 
| 
       316 
316 
     | 
    
         
             
                    sk = this.get('storeKey'),
         
     | 
| 
       317 
317 
     | 
    
         
             
                    prKey = store.parentStoreKeyExists();
         
     | 
| 
         @@ -325,12 +325,12 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       325 
325 
     | 
    
         
             
                  // If there are any aggregate records, we might need to propagate our new
         
     | 
| 
       326 
326 
     | 
    
         
             
                  // status to them.
         
     | 
| 
       327 
327 
     | 
    
         
             
                  this.propagateToAggregates();
         
     | 
| 
       328 
     | 
    
         
            -
             
     | 
| 
      
 328 
     | 
    
         
            +
             
     | 
| 
       329 
329 
     | 
    
         
             
                } else if (prKey){
         
     | 
| 
       330 
330 
     | 
    
         
             
                  rec = store.materializeRecord(prKey);
         
     | 
| 
       331 
331 
     | 
    
         
             
                  rec.destroy(recordOnly);
         
     | 
| 
       332 
332 
     | 
    
         
             
                }
         
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
      
 333 
     | 
    
         
            +
             
     | 
| 
       334 
334 
     | 
    
         
             
                return this ;
         
     | 
| 
       335 
335 
     | 
    
         
             
              },
         
     | 
| 
       336 
336 
     | 
    
         | 
| 
         @@ -338,22 +338,22 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       338 
338 
     | 
    
         
             
                You can invoke this method anytime you need to make the record as dirty.
         
     | 
| 
       339 
339 
     | 
    
         
             
                This will cause the record to be commited when you `commitChanges()`
         
     | 
| 
       340 
340 
     | 
    
         
             
                on the underlying store.
         
     | 
| 
       341 
     | 
    
         
            -
             
     | 
| 
       342 
     | 
    
         
            -
                If you use the `writeAttribute()` primitive, this method will be called 
     | 
| 
      
 341 
     | 
    
         
            +
             
     | 
| 
      
 342 
     | 
    
         
            +
                If you use the `writeAttribute()` primitive, this method will be called
         
     | 
| 
       343 
343 
     | 
    
         
             
                for you.
         
     | 
| 
       344 
     | 
    
         
            -
             
     | 
| 
      
 344 
     | 
    
         
            +
             
     | 
| 
       345 
345 
     | 
    
         
             
                If you pass the key that changed it will ensure that observers are fired
         
     | 
| 
       346 
346 
     | 
    
         
             
                only once for the changed property instead of `allPropertiesDidChange()`
         
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
      
 347 
     | 
    
         
            +
             
     | 
| 
       348 
348 
     | 
    
         
             
                @param {String} key key that changed (optional)
         
     | 
| 
       349 
349 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
       350 
350 
     | 
    
         
             
              */
         
     | 
| 
       351 
351 
     | 
    
         
             
              recordDidChange: function(key) {
         
     | 
| 
       352 
     | 
    
         
            -
             
     | 
| 
      
 352 
     | 
    
         
            +
             
     | 
| 
       353 
353 
     | 
    
         
             
                // If we have a parent, they changed too!
         
     | 
| 
       354 
354 
     | 
    
         
             
                var p = this.get('parentRecord');
         
     | 
| 
       355 
355 
     | 
    
         
             
                if (p) p.recordDidChange();
         
     | 
| 
       356 
     | 
    
         
            -
             
     | 
| 
      
 356 
     | 
    
         
            +
             
     | 
| 
       357 
357 
     | 
    
         
             
                this.get('store').recordDidChange(null, null, this.get('storeKey'), key);
         
     | 
| 
       358 
358 
     | 
    
         
             
                this.notifyPropertyChange('status');
         
     | 
| 
       359 
359 
     | 
    
         | 
| 
         @@ -363,23 +363,27 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       363 
363 
     | 
    
         | 
| 
       364 
364 
     | 
    
         
             
                return this ;
         
     | 
| 
       365 
365 
     | 
    
         
             
              },
         
     | 
| 
       366 
     | 
    
         
            -
             
     | 
| 
      
 366 
     | 
    
         
            +
             
     | 
| 
      
 367 
     | 
    
         
            +
              toJSON: function(){
         
     | 
| 
      
 368 
     | 
    
         
            +
                return this.get('attributes');
         
     | 
| 
      
 369 
     | 
    
         
            +
              },
         
     | 
| 
      
 370 
     | 
    
         
            +
             
     | 
| 
       367 
371 
     | 
    
         
             
              // ...............................
         
     | 
| 
       368 
372 
     | 
    
         
             
              // ATTRIBUTES
         
     | 
| 
       369 
373 
     | 
    
         
             
              //
         
     | 
| 
       370 
374 
     | 
    
         | 
| 
       371 
375 
     | 
    
         
             
              /** @private
         
     | 
| 
       372 
     | 
    
         
            -
                Current edit level.  Used to defer editing changes. 
     | 
| 
      
 376 
     | 
    
         
            +
                Current edit level.  Used to defer editing changes.
         
     | 
| 
       373 
377 
     | 
    
         
             
              */
         
     | 
| 
       374 
378 
     | 
    
         
             
              _editLevel: 0 ,
         
     | 
| 
       375 
     | 
    
         
            -
             
     | 
| 
      
 379 
     | 
    
         
            +
             
     | 
| 
       376 
380 
     | 
    
         
             
              /**
         
     | 
| 
       377 
     | 
    
         
            -
                Defers notification of record changes until you call a matching 
     | 
| 
      
 381 
     | 
    
         
            +
                Defers notification of record changes until you call a matching
         
     | 
| 
       378 
382 
     | 
    
         
             
                `endEditing()` method.  This method is called automatically whenever you
         
     | 
| 
       379 
383 
     | 
    
         
             
                set an attribute, but you can call it yourself to group multiple changes.
         
     | 
| 
       380 
     | 
    
         
            -
             
     | 
| 
      
 384 
     | 
    
         
            +
             
     | 
| 
       381 
385 
     | 
    
         
             
                Calls to `beginEditing()` and `endEditing()` can be nested.
         
     | 
| 
       382 
     | 
    
         
            -
             
     | 
| 
      
 386 
     | 
    
         
            +
             
     | 
| 
       383 
387 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
       384 
388 
     | 
    
         
             
              */
         
     | 
| 
       385 
389 
     | 
    
         
             
              beginEditing: function() {
         
     | 
| 
         @@ -391,50 +395,50 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       391 
395 
     | 
    
         
             
                Notifies the store of record changes if this matches a top level call to
         
     | 
| 
       392 
396 
     | 
    
         
             
                `beginEditing()`.  This method is called automatically whenever you set an
         
     | 
| 
       393 
397 
     | 
    
         
             
                attribute, but you can call it yourself to group multiple changes.
         
     | 
| 
       394 
     | 
    
         
            -
             
     | 
| 
      
 398 
     | 
    
         
            +
             
     | 
| 
       395 
399 
     | 
    
         
             
                Calls to `beginEditing()` and `endEditing()` can be nested.
         
     | 
| 
       396 
     | 
    
         
            -
             
     | 
| 
      
 400 
     | 
    
         
            +
             
     | 
| 
       397 
401 
     | 
    
         
             
                @param {String} key key that changed (optional)
         
     | 
| 
       398 
402 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
       399 
403 
     | 
    
         
             
              */
         
     | 
| 
       400 
404 
     | 
    
         
             
              endEditing: function(key) {
         
     | 
| 
       401 
405 
     | 
    
         
             
                if(--this._editLevel <= 0) {
         
     | 
| 
       402 
     | 
    
         
            -
                  this._editLevel = 0; 
     | 
| 
      
 406 
     | 
    
         
            +
                  this._editLevel = 0;
         
     | 
| 
       403 
407 
     | 
    
         
             
                  this.recordDidChange(key);
         
     | 
| 
       404 
408 
     | 
    
         
             
                }
         
     | 
| 
       405 
409 
     | 
    
         
             
                return this ;
         
     | 
| 
       406 
410 
     | 
    
         
             
              },
         
     | 
| 
       407 
     | 
    
         
            -
             
     | 
| 
      
 411 
     | 
    
         
            +
             
     | 
| 
       408 
412 
     | 
    
         
             
              /**
         
     | 
| 
       409 
413 
     | 
    
         
             
                Reads the raw attribute from the underlying data hash.  This method does
         
     | 
| 
       410 
414 
     | 
    
         
             
                not transform the underlying attribute at all.
         
     | 
| 
       411 
     | 
    
         
            -
             
     | 
| 
      
 415 
     | 
    
         
            +
             
     | 
| 
       412 
416 
     | 
    
         
             
                @param {String} key the attribute you want to read
         
     | 
| 
       413 
417 
     | 
    
         
             
                @returns {Object} the value of the key, or undefined if it doesn't exist
         
     | 
| 
       414 
418 
     | 
    
         
             
              */
         
     | 
| 
       415 
419 
     | 
    
         
             
              readAttribute: function(key) {
         
     | 
| 
       416 
420 
     | 
    
         
             
                var store = this.get('store'), storeKey = this.storeKey;
         
     | 
| 
       417 
421 
     | 
    
         
             
                var attrs = store.readDataHash(storeKey);
         
     | 
| 
       418 
     | 
    
         
            -
                return attrs ? attrs[key] : undefined ; 
     | 
| 
      
 422 
     | 
    
         
            +
                return attrs ? attrs[key] : undefined ;
         
     | 
| 
       419 
423 
     | 
    
         
             
              },
         
     | 
| 
       420 
424 
     | 
    
         | 
| 
       421 
425 
     | 
    
         
             
              /**
         
     | 
| 
       422 
     | 
    
         
            -
                Updates the passed attribute with the new value.  This method does not 
     | 
| 
       423 
     | 
    
         
            -
                transform the value at all.  If instead you want to modify an array or 
     | 
| 
       424 
     | 
    
         
            -
                hash already defined on the underlying json, you should instead get 
     | 
| 
      
 426 
     | 
    
         
            +
                Updates the passed attribute with the new value.  This method does not
         
     | 
| 
      
 427 
     | 
    
         
            +
                transform the value at all.  If instead you want to modify an array or
         
     | 
| 
      
 428 
     | 
    
         
            +
                hash already defined on the underlying json, you should instead get
         
     | 
| 
       425 
429 
     | 
    
         
             
                an editable version of the attribute using `editableAttribute()`.
         
     | 
| 
       426 
     | 
    
         
            -
             
     | 
| 
      
 430 
     | 
    
         
            +
             
     | 
| 
       427 
431 
     | 
    
         
             
                @param {String} key the attribute you want to read
         
     | 
| 
       428 
432 
     | 
    
         
             
                @param {Object} value the value you want to write
         
     | 
| 
       429 
     | 
    
         
            -
                @param {Boolean} ignoreDidChange only set if you do NOT want to flag 
     | 
| 
      
 433 
     | 
    
         
            +
                @param {Boolean} ignoreDidChange only set if you do NOT want to flag
         
     | 
| 
       430 
434 
     | 
    
         
             
                  record as dirty
         
     | 
| 
       431 
435 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
       432 
436 
     | 
    
         
             
              */
         
     | 
| 
       433 
437 
     | 
    
         
             
              writeAttribute: function(key, value, ignoreDidChange) {
         
     | 
| 
       434 
     | 
    
         
            -
                var store    = this.get('store'), 
     | 
| 
      
 438 
     | 
    
         
            +
                var store    = this.get('store'),
         
     | 
| 
       435 
439 
     | 
    
         
             
                    storeKey = this.storeKey,
         
     | 
| 
       436 
440 
     | 
    
         
             
                    attrs;
         
     | 
| 
       437 
     | 
    
         
            -
             
     | 
| 
      
 441 
     | 
    
         
            +
             
     | 
| 
       438 
442 
     | 
    
         
             
                attrs = store.readEditableDataHash(storeKey);
         
     | 
| 
       439 
443 
     | 
    
         
             
                if (!attrs) throw SC.Record.BAD_STATE_ERROR;
         
     | 
| 
       440 
444 
     | 
    
         | 
| 
         @@ -442,33 +446,33 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       442 
446 
     | 
    
         
             
                if (value !== attrs[key]) {
         
     | 
| 
       443 
447 
     | 
    
         
             
                  if(!ignoreDidChange) this.beginEditing();
         
     | 
| 
       444 
448 
     | 
    
         
             
                  attrs[key] = value;
         
     | 
| 
       445 
     | 
    
         
            -
             
     | 
| 
      
 449 
     | 
    
         
            +
             
     | 
| 
       446 
450 
     | 
    
         
             
                  // If the key is the primaryKey of the record, we need to tell the store
         
     | 
| 
       447 
451 
     | 
    
         
             
                  // about the change.
         
     | 
| 
       448 
452 
     | 
    
         
             
                  if (key===this.get('primaryKey')) {
         
     | 
| 
       449 
453 
     | 
    
         
             
                    SC.Store.replaceIdFor(storeKey, value) ;
         
     | 
| 
       450 
454 
     | 
    
         
             
                    this.propertyDidChange('id'); // Reset computed value
         
     | 
| 
       451 
455 
     | 
    
         
             
                  }
         
     | 
| 
       452 
     | 
    
         
            -
             
     | 
| 
      
 456 
     | 
    
         
            +
             
     | 
| 
       453 
457 
     | 
    
         
             
                  if(!ignoreDidChange) this.endEditing(key);
         
     | 
| 
       454 
458 
     | 
    
         
             
                }
         
     | 
| 
       455 
459 
     | 
    
         
             
                return this ;
         
     | 
| 
       456 
460 
     | 
    
         
             
              },
         
     | 
| 
       457 
     | 
    
         
            -
             
     | 
| 
      
 461 
     | 
    
         
            +
             
     | 
| 
       458 
462 
     | 
    
         
             
              /**
         
     | 
| 
       459 
463 
     | 
    
         
             
                This will also ensure that any aggregate records are also marked dirty
         
     | 
| 
       460 
464 
     | 
    
         
             
                if this record changes.
         
     | 
| 
       461 
     | 
    
         
            -
             
     | 
| 
      
 465 
     | 
    
         
            +
             
     | 
| 
       462 
466 
     | 
    
         
             
                Should not have to be called manually.
         
     | 
| 
       463 
467 
     | 
    
         
             
              */
         
     | 
| 
       464 
468 
     | 
    
         
             
              propagateToAggregates: function() {
         
     | 
| 
       465 
469 
     | 
    
         
             
                var storeKey = this.get('storeKey'),
         
     | 
| 
       466 
     | 
    
         
            -
                    recordType = SC.Store.recordTypeFor(storeKey), 
     | 
| 
      
 470 
     | 
    
         
            +
                    recordType = SC.Store.recordTypeFor(storeKey),
         
     | 
| 
       467 
471 
     | 
    
         
             
                    idx, len, key, val, recs;
         
     | 
| 
       468 
     | 
    
         
            -
             
     | 
| 
      
 472 
     | 
    
         
            +
             
     | 
| 
       469 
473 
     | 
    
         
             
                var aggregates = recordType.aggregates;
         
     | 
| 
       470 
     | 
    
         
            -
             
     | 
| 
       471 
     | 
    
         
            -
                // if recordType aggregates are not set up yet, make sure to 
     | 
| 
      
 474 
     | 
    
         
            +
             
     | 
| 
      
 475 
     | 
    
         
            +
                // if recordType aggregates are not set up yet, make sure to
         
     | 
| 
       472 
476 
     | 
    
         
             
                // create the cache first
         
     | 
| 
       473 
477 
     | 
    
         
             
                if (!aggregates) {
         
     | 
| 
       474 
478 
     | 
    
         
             
                  var dataHash = this.get('store').readDataHash(storeKey);
         
     | 
| 
         @@ -480,7 +484,7 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       480 
484 
     | 
    
         
             
                  }
         
     | 
| 
       481 
485 
     | 
    
         
             
                  recordType.aggregates = aggregates;
         
     | 
| 
       482 
486 
     | 
    
         
             
                }
         
     | 
| 
       483 
     | 
    
         
            -
             
     | 
| 
      
 487 
     | 
    
         
            +
             
     | 
| 
       484 
488 
     | 
    
         
             
                // now loop through all aggregate properties and mark their related
         
     | 
| 
       485 
489 
     | 
    
         
             
                // record objects as dirty
         
     | 
| 
       486 
490 
     | 
    
         
             
                var K          = SC.Record,
         
     | 
| 
         @@ -489,23 +493,23 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       489 
493 
     | 
    
         
             
                    destroyed  = K.DESTROYED,
         
     | 
| 
       490 
494 
     | 
    
         
             
                    readyClean = K.READY_CLEAN,
         
     | 
| 
       491 
495 
     | 
    
         
             
                    iter;
         
     | 
| 
       492 
     | 
    
         
            -
             
     | 
| 
      
 496 
     | 
    
         
            +
             
     | 
| 
       493 
497 
     | 
    
         
             
                /**
         
     | 
| 
       494 
498 
     | 
    
         
             
                  @private
         
     | 
| 
       495 
     | 
    
         
            -
             
     | 
| 
      
 499 
     | 
    
         
            +
             
     | 
| 
       496 
500 
     | 
    
         
             
                  If the child is dirty, then make sure the parent gets a dirty
         
     | 
| 
       497 
501 
     | 
    
         
             
                  status.  (If the child is created or destroyed, there's no need,
         
     | 
| 
       498 
502 
     | 
    
         
             
                  because the parent will dirty itself when it modifies that
         
     | 
| 
       499 
503 
     | 
    
         
             
                  relationship.)
         
     | 
| 
       500 
     | 
    
         
            -
             
     | 
| 
      
 504 
     | 
    
         
            +
             
     | 
| 
       501 
505 
     | 
    
         
             
                  @param {SC.Record} record to propagate to
         
     | 
| 
       502 
506 
     | 
    
         
             
                */
         
     | 
| 
       503 
507 
     | 
    
         
             
                iter =  function(rec) {
         
     | 
| 
       504 
508 
     | 
    
         
             
                  var childStatus, parentStatus;
         
     | 
| 
       505 
     | 
    
         
            -
             
     | 
| 
       506 
     | 
    
         
            -
                  if (rec) { 
     | 
| 
      
 509 
     | 
    
         
            +
             
     | 
| 
      
 510 
     | 
    
         
            +
                  if (rec) {
         
     | 
| 
       507 
511 
     | 
    
         
             
                    childStatus = this.get('status');
         
     | 
| 
       508 
     | 
    
         
            -
                    if ((childStatus & dirty)  || 
     | 
| 
      
 512 
     | 
    
         
            +
                    if ((childStatus & dirty)  ||
         
     | 
| 
       509 
513 
     | 
    
         
             
                        (childStatus & readyNew)  ||  (childStatus & destroyed)) {
         
     | 
| 
       510 
514 
     | 
    
         
             
                      parentStatus = rec.get('status');
         
     | 
| 
       511 
515 
     | 
    
         
             
                      if (parentStatus === readyClean) {
         
     | 
| 
         @@ -516,7 +520,7 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       516 
520 
     | 
    
         
             
                    }
         
     | 
| 
       517 
521 
     | 
    
         
             
                  }
         
     | 
| 
       518 
522 
     | 
    
         
             
                };
         
     | 
| 
       519 
     | 
    
         
            -
             
     | 
| 
      
 523 
     | 
    
         
            +
             
     | 
| 
       520 
524 
     | 
    
         
             
                for(idx=0,len=aggregates.length;idx<len;++idx) {
         
     | 
| 
       521 
525 
     | 
    
         
             
                  key = aggregates[idx];
         
     | 
| 
       522 
526 
     | 
    
         
             
                  val = this.get(key);
         
     | 
| 
         @@ -524,12 +528,12 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       524 
528 
     | 
    
         
             
                  recs.forEach(iter, this);
         
     | 
| 
       525 
529 
     | 
    
         
             
                }
         
     | 
| 
       526 
530 
     | 
    
         
             
              },
         
     | 
| 
       527 
     | 
    
         
            -
             
     | 
| 
      
 531 
     | 
    
         
            +
             
     | 
| 
       528 
532 
     | 
    
         
             
              /**
         
     | 
| 
       529 
533 
     | 
    
         
             
                Called by the store whenever the underlying data hash has changed.  This
         
     | 
| 
       530 
534 
     | 
    
         
             
                will notify any observers interested in data hash properties that they
         
     | 
| 
       531 
535 
     | 
    
         
             
                have changed.
         
     | 
| 
       532 
     | 
    
         
            -
             
     | 
| 
      
 536 
     | 
    
         
            +
             
     | 
| 
       533 
537 
     | 
    
         
             
                @param {Boolean} statusOnly changed
         
     | 
| 
       534 
538 
     | 
    
         
             
                @param {String} key that changed (optional)
         
     | 
| 
       535 
539 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
         @@ -538,54 +542,54 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       538 
542 
     | 
    
         
             
                // TODO:  Should this function call propagateToAggregates() at the
         
     | 
| 
       539 
543 
     | 
    
         
             
                //        appropriate times?
         
     | 
| 
       540 
544 
     | 
    
         
             
                if (statusOnly) this.notifyPropertyChange('status');
         
     | 
| 
       541 
     | 
    
         
            -
                else { 
     | 
| 
      
 545 
     | 
    
         
            +
                else {
         
     | 
| 
       542 
546 
     | 
    
         
             
                  if (keys) {
         
     | 
| 
       543 
547 
     | 
    
         
             
                    this.beginPropertyChanges();
         
     | 
| 
       544 
548 
     | 
    
         
             
                    keys.forEach(function(k) { this.notifyPropertyChange(k); }, this);
         
     | 
| 
       545 
     | 
    
         
            -
                    this.notifyPropertyChange('status'); 
     | 
| 
      
 549 
     | 
    
         
            +
                    this.notifyPropertyChange('status');
         
     | 
| 
       546 
550 
     | 
    
         
             
                    this.endPropertyChanges();
         
     | 
| 
       547 
551 
     | 
    
         | 
| 
       548 
     | 
    
         
            -
                  } else this.allPropertiesDidChange(); 
     | 
| 
       549 
     | 
    
         
            -
             
     | 
| 
      
 552 
     | 
    
         
            +
                  } else this.allPropertiesDidChange();
         
     | 
| 
      
 553 
     | 
    
         
            +
             
     | 
| 
       550 
554 
     | 
    
         
             
                  // also notify manyArrays
         
     | 
| 
       551 
555 
     | 
    
         
             
                  var manyArrays = this.relationships,
         
     | 
| 
       552 
556 
     | 
    
         
             
                      loc        = manyArrays ? manyArrays.length : 0 ;
         
     | 
| 
       553 
     | 
    
         
            -
                  while(--loc>=0) manyArrays[loc].recordPropertyDidChange(keys); 
     | 
| 
      
 557 
     | 
    
         
            +
                  while(--loc>=0) manyArrays[loc].recordPropertyDidChange(keys);
         
     | 
| 
       554 
558 
     | 
    
         
             
                }
         
     | 
| 
       555 
559 
     | 
    
         
             
              },
         
     | 
| 
       556 
     | 
    
         
            -
             
     | 
| 
      
 560 
     | 
    
         
            +
             
     | 
| 
       557 
561 
     | 
    
         
             
              /**
         
     | 
| 
       558 
562 
     | 
    
         
             
                Normalizing a record will ensure that the underlying hash conforms
         
     | 
| 
       559 
     | 
    
         
            -
                to the record attributes such as their types (transforms) and default 
     | 
| 
       560 
     | 
    
         
            -
                values. 
     | 
| 
       561 
     | 
    
         
            -
             
     | 
| 
      
 563 
     | 
    
         
            +
                to the record attributes such as their types (transforms) and default
         
     | 
| 
      
 564 
     | 
    
         
            +
                values.
         
     | 
| 
      
 565 
     | 
    
         
            +
             
     | 
| 
       562 
566 
     | 
    
         
             
                This method will write the conforming hash to the store and return
         
     | 
| 
       563 
567 
     | 
    
         
             
                the materialized record.
         
     | 
| 
       564 
     | 
    
         
            -
             
     | 
| 
      
 568 
     | 
    
         
            +
             
     | 
| 
       565 
569 
     | 
    
         
             
                By normalizing the record, you can use `.attributes()` and be
         
     | 
| 
       566 
570 
     | 
    
         
             
                assured that it will conform to the defined model. For example, this
         
     | 
| 
       567 
571 
     | 
    
         
             
                can be useful in the case where you need to send a JSON representation
         
     | 
| 
       568 
572 
     | 
    
         
             
                to some server after you have used `.createRecord()`, since this method
         
     | 
| 
       569 
573 
     | 
    
         
             
                will enforce the 'rules' in the model such as their types and default
         
     | 
| 
       570 
     | 
    
         
            -
                values. You can also include null values in the hash with the 
     | 
| 
      
 574 
     | 
    
         
            +
                values. You can also include null values in the hash with the
         
     | 
| 
       571 
575 
     | 
    
         
             
                includeNull argument.
         
     | 
| 
       572 
     | 
    
         
            -
             
     | 
| 
      
 576 
     | 
    
         
            +
             
     | 
| 
       573 
577 
     | 
    
         
             
                @param {Boolean} includeNull will write empty (null) attributes
         
     | 
| 
       574 
578 
     | 
    
         
             
                @returns {SC.Record} the normalized record
         
     | 
| 
       575 
579 
     | 
    
         
             
              */
         
     | 
| 
       576 
     | 
    
         
            -
             
     | 
| 
       577 
     | 
    
         
            -
              normalize: function(includeNull) { 
     | 
| 
       578 
     | 
    
         
            -
                var primaryKey = this.primaryKey, 
     | 
| 
       579 
     | 
    
         
            -
                    recordId   = this.get('id'), 
     | 
| 
       580 
     | 
    
         
            -
                    store      = this.get('store'), 
     | 
| 
       581 
     | 
    
         
            -
                    storeKey   = this.get('storeKey'), 
     | 
| 
      
 580 
     | 
    
         
            +
             
     | 
| 
      
 581 
     | 
    
         
            +
              normalize: function(includeNull) {
         
     | 
| 
      
 582 
     | 
    
         
            +
                var primaryKey = this.primaryKey,
         
     | 
| 
      
 583 
     | 
    
         
            +
                    recordId   = this.get('id'),
         
     | 
| 
      
 584 
     | 
    
         
            +
                    store      = this.get('store'),
         
     | 
| 
      
 585 
     | 
    
         
            +
                    storeKey   = this.get('storeKey'),
         
     | 
| 
       582 
586 
     | 
    
         
             
                    key, valueForKey, typeClass, recHash, attrValue, normChild,  isRecord,
         
     | 
| 
       583 
587 
     | 
    
         
             
                    isChild, defaultVal, keyForDataHash, attr;
         
     | 
| 
       584 
     | 
    
         
            -
             
     | 
| 
      
 588 
     | 
    
         
            +
             
     | 
| 
       585 
589 
     | 
    
         
             
                var dataHash = store.readEditableDataHash(storeKey) || {};
         
     | 
| 
       586 
590 
     | 
    
         
             
                dataHash[primaryKey] = recordId;
         
     | 
| 
       587 
591 
     | 
    
         
             
                recHash = store.readDataHash(storeKey);
         
     | 
| 
       588 
     | 
    
         
            -
             
     | 
| 
      
 592 
     | 
    
         
            +
             
     | 
| 
       589 
593 
     | 
    
         
             
                for (key in this) {
         
     | 
| 
       590 
594 
     | 
    
         
             
                  // make sure property is a record attribute.
         
     | 
| 
       591 
595 
     | 
    
         
             
                  valueForKey = this[key];
         
     | 
| 
         @@ -605,7 +609,7 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       605 
609 
     | 
    
         
             
                          }
         
     | 
| 
       606 
610 
     | 
    
         
             
                          dataHash[keyForDataHash] = attrValue;
         
     | 
| 
       607 
611 
     | 
    
         
             
                        }
         
     | 
| 
       608 
     | 
    
         
            -
             
     | 
| 
      
 612 
     | 
    
         
            +
             
     | 
| 
       609 
613 
     | 
    
         
             
                      } else if (isChild) {
         
     | 
| 
       610 
614 
     | 
    
         
             
                        attrValue = this.get(key);
         
     | 
| 
       611 
615 
     | 
    
         | 
| 
         @@ -627,7 +631,7 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       627 
631 
     | 
    
         
             
                          if (SC.typeOf(defaultVal)===SC.T_FUNCTION) {
         
     | 
| 
       628 
632 
     | 
    
         
             
                            dataHash[keyForDataHash] = defaultVal(this, key, defaultVal);
         
     | 
| 
       629 
633 
     | 
    
         
             
                          } else {
         
     | 
| 
       630 
     | 
    
         
            -
                            // plain value 
     | 
| 
      
 634 
     | 
    
         
            +
                            // plain value
         
     | 
| 
       631 
635 
     | 
    
         
             
                            dataHash[keyForDataHash] = defaultVal;
         
     | 
| 
       632 
636 
     | 
    
         
             
                          }
         
     | 
| 
       633 
637 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -639,37 +643,37 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       639 
643 
     | 
    
         
             
                return this;
         
     | 
| 
       640 
644 
     | 
    
         
             
              },
         
     | 
| 
       641 
645 
     | 
    
         | 
| 
       642 
     | 
    
         
            -
             
     | 
| 
       643 
     | 
    
         
            -
             
     | 
| 
      
 646 
     | 
    
         
            +
             
     | 
| 
      
 647 
     | 
    
         
            +
             
     | 
| 
       644 
648 
     | 
    
         
             
              /**
         
     | 
| 
       645 
     | 
    
         
            -
                If you try to get/set a property not defined by the record, then this 
     | 
| 
       646 
     | 
    
         
            -
                method will be called. It will try to get the value from the set of 
     | 
| 
      
 649 
     | 
    
         
            +
                If you try to get/set a property not defined by the record, then this
         
     | 
| 
      
 650 
     | 
    
         
            +
                method will be called. It will try to get the value from the set of
         
     | 
| 
       647 
651 
     | 
    
         
             
                attributes.
         
     | 
| 
       648 
     | 
    
         
            -
             
     | 
| 
      
 652 
     | 
    
         
            +
             
     | 
| 
       649 
653 
     | 
    
         
             
                This will also check is `ignoreUnknownProperties` is set on the recordType
         
     | 
| 
       650 
654 
     | 
    
         
             
                so that they will not be written to `dataHash` unless explicitly defined
         
     | 
| 
       651 
655 
     | 
    
         
             
                in the model schema.
         
     | 
| 
       652 
     | 
    
         
            -
             
     | 
| 
      
 656 
     | 
    
         
            +
             
     | 
| 
       653 
657 
     | 
    
         
             
                @param {String} key the attribute being get/set
         
     | 
| 
       654 
658 
     | 
    
         
             
                @param {Object} value the value to set the key to, if present
         
     | 
| 
       655 
659 
     | 
    
         
             
                @returns {Object} the value
         
     | 
| 
       656 
660 
     | 
    
         
             
              */
         
     | 
| 
       657 
661 
     | 
    
         
             
              unknownProperty: function(key, value) {
         
     | 
| 
       658 
     | 
    
         
            -
             
     | 
| 
      
 662 
     | 
    
         
            +
             
     | 
| 
       659 
663 
     | 
    
         
             
                if (value !== undefined) {
         
     | 
| 
       660 
     | 
    
         
            -
             
     | 
| 
       661 
     | 
    
         
            -
                  // first check if we should ignore unknown properties for this 
     | 
| 
      
 664 
     | 
    
         
            +
             
     | 
| 
      
 665 
     | 
    
         
            +
                  // first check if we should ignore unknown properties for this
         
     | 
| 
       662 
666 
     | 
    
         
             
                  // recordType
         
     | 
| 
       663 
667 
     | 
    
         
             
                  var storeKey = this.get('storeKey'),
         
     | 
| 
       664 
668 
     | 
    
         
             
                    recordType = SC.Store.recordTypeFor(storeKey);
         
     | 
| 
       665 
     | 
    
         
            -
             
     | 
| 
      
 669 
     | 
    
         
            +
             
     | 
| 
       666 
670 
     | 
    
         
             
                  if(recordType.ignoreUnknownProperties===YES) {
         
     | 
| 
       667 
671 
     | 
    
         
             
                    this[key] = value;
         
     | 
| 
       668 
672 
     | 
    
         
             
                    return value;
         
     | 
| 
       669 
673 
     | 
    
         
             
                  }
         
     | 
| 
       670 
     | 
    
         
            -
             
     | 
| 
       671 
     | 
    
         
            -
                  // if we're modifying the PKEY, then `SC.Store` needs to relocate where 
     | 
| 
       672 
     | 
    
         
            -
                  // this record is cached. store the old key, update the value, then let 
     | 
| 
      
 674 
     | 
    
         
            +
             
     | 
| 
      
 675 
     | 
    
         
            +
                  // if we're modifying the PKEY, then `SC.Store` needs to relocate where
         
     | 
| 
      
 676 
     | 
    
         
            +
                  // this record is cached. store the old key, update the value, then let
         
     | 
| 
       673 
677 
     | 
    
         
             
                  // the store do the housekeeping...
         
     | 
| 
       674 
678 
     | 
    
         
             
                  var primaryKey = this.get('primaryKey');
         
     | 
| 
       675 
679 
     | 
    
         
             
                  this.writeAttribute(key,value);
         
     | 
| 
         @@ -678,28 +682,28 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       678 
682 
     | 
    
         
             
                  if (key === primaryKey) {
         
     | 
| 
       679 
683 
     | 
    
         
             
                    SC.Store.replaceIdFor(storeKey, value);
         
     | 
| 
       680 
684 
     | 
    
         
             
                  }
         
     | 
| 
       681 
     | 
    
         
            -
             
     | 
| 
      
 685 
     | 
    
         
            +
             
     | 
| 
       682 
686 
     | 
    
         
             
                }
         
     | 
| 
       683 
687 
     | 
    
         
             
                return this.readAttribute(key);
         
     | 
| 
       684 
688 
     | 
    
         
             
              },
         
     | 
| 
       685 
     | 
    
         
            -
             
     | 
| 
      
 689 
     | 
    
         
            +
             
     | 
| 
       686 
690 
     | 
    
         
             
              /**
         
     | 
| 
       687 
691 
     | 
    
         
             
                Lets you commit this specific record to the store which will trigger
         
     | 
| 
       688 
692 
     | 
    
         
             
                the appropriate methods in the data source for you.
         
     | 
| 
       689 
     | 
    
         
            -
             
     | 
| 
      
 693 
     | 
    
         
            +
             
     | 
| 
       690 
694 
     | 
    
         
             
                @param {Hash} params optional additonal params that will passed down
         
     | 
| 
       691 
695 
     | 
    
         
             
                  to the data source
         
     | 
| 
       692 
696 
     | 
    
         
             
                @param {boolean} recordOnly optional param if you want to only commit a single
         
     | 
| 
       693 
697 
     | 
    
         
             
                  record if it has a parent.
         
     | 
| 
       694 
     | 
    
         
            -
                @param {Function} callback optional callback that the store will fire once the 
     | 
| 
      
 698 
     | 
    
         
            +
                @param {Function} callback optional callback that the store will fire once the
         
     | 
| 
       695 
699 
     | 
    
         
             
                datasource finished committing
         
     | 
| 
       696 
700 
     | 
    
         
             
                @returns {SC.Record} receiver
         
     | 
| 
       697 
701 
     | 
    
         
             
              */
         
     | 
| 
       698 
     | 
    
         
            -
              commitRecord: function(params, recordOnly, callback) { 
     | 
| 
      
 702 
     | 
    
         
            +
              commitRecord: function(params, recordOnly, callback) {
         
     | 
| 
       699 
703 
     | 
    
         
             
                var store = this.get('store'), rec, ro,
         
     | 
| 
       700 
704 
     | 
    
         
             
                    sk = this.get('storeKey'),
         
     | 
| 
       701 
705 
     | 
    
         
             
                    prKey = store.parentStoreKeyExists();
         
     | 
| 
       702 
     | 
    
         
            -
             
     | 
| 
      
 706 
     | 
    
         
            +
             
     | 
| 
       703 
707 
     | 
    
         
             
                // If we only want to commit this record or it doesn't have a parent record
         
     | 
| 
       704 
708 
     | 
    
         
             
                // we will commit this record
         
     | 
| 
       705 
709 
     | 
    
         
             
                ro = recordOnly || (SC.none(recordOnly) && SC.none(prKey));
         
     | 
| 
         @@ -711,15 +715,15 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       711 
715 
     | 
    
         
             
                }
         
     | 
| 
       712 
716 
     | 
    
         
             
                return this ;
         
     | 
| 
       713 
717 
     | 
    
         
             
              },
         
     | 
| 
       714 
     | 
    
         
            -
             
     | 
| 
      
 718 
     | 
    
         
            +
             
     | 
| 
       715 
719 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       716 
720 
     | 
    
         
             
              // EMULATE SC.ERROR API
         
     | 
| 
       717 
     | 
    
         
            -
              // 
     | 
| 
       718 
     | 
    
         
            -
             
     | 
| 
      
 721 
     | 
    
         
            +
              //
         
     | 
| 
      
 722 
     | 
    
         
            +
             
     | 
| 
       719 
723 
     | 
    
         
             
              /**
         
     | 
| 
       720 
724 
     | 
    
         
             
                Returns `YES` whenever the status is SC.Record.ERROR.  This will allow you
         
     | 
| 
       721 
725 
     | 
    
         
             
                to put the UI into an error state.
         
     | 
| 
       722 
     | 
    
         
            -
             
     | 
| 
      
 726 
     | 
    
         
            +
             
     | 
| 
       723 
727 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       724 
728 
     | 
    
         
             
                @property
         
     | 
| 
       725 
729 
     | 
    
         
             
                @dependsOn status
         
     | 
| 
         @@ -731,7 +735,7 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       731 
735 
     | 
    
         
             
              /**
         
     | 
| 
       732 
736 
     | 
    
         
             
                Returns the receiver if the record is in an error state.  Returns null
         
     | 
| 
       733 
737 
     | 
    
         
             
                otherwise.
         
     | 
| 
       734 
     | 
    
         
            -
             
     | 
| 
      
 738 
     | 
    
         
            +
             
     | 
| 
       735 
739 
     | 
    
         
             
                @type SC.Record
         
     | 
| 
       736 
740 
     | 
    
         
             
                @property
         
     | 
| 
       737 
741 
     | 
    
         
             
                @dependsOn isError
         
     | 
| 
         @@ -739,11 +743,11 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       739 
743 
     | 
    
         
             
              errorValue: function() {
         
     | 
| 
       740 
744 
     | 
    
         
             
                return this.get('isError') ? SC.val(this.get('errorObject')) : null ;
         
     | 
| 
       741 
745 
     | 
    
         
             
              }.property('isError').cacheable(),
         
     | 
| 
       742 
     | 
    
         
            -
             
     | 
| 
      
 746 
     | 
    
         
            +
             
     | 
| 
       743 
747 
     | 
    
         
             
              /**
         
     | 
| 
       744 
748 
     | 
    
         
             
                Returns the current error object only if the record is in an error state.
         
     | 
| 
       745 
749 
     | 
    
         
             
                If no explicit error object has been set, returns SC.Record.GENERIC_ERROR.
         
     | 
| 
       746 
     | 
    
         
            -
             
     | 
| 
      
 750 
     | 
    
         
            +
             
     | 
| 
       747 
751 
     | 
    
         
             
                @type SC.Error
         
     | 
| 
       748 
752 
     | 
    
         
             
                @property
         
     | 
| 
       749 
753 
     | 
    
         
             
                @dependsOn isError
         
     | 
| 
         @@ -754,11 +758,11 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       754 
758 
     | 
    
         
             
                  return store.readError(this.get('storeKey')) || SC.Record.GENERIC_ERROR;
         
     | 
| 
       755 
759 
     | 
    
         
             
                } else return null ;
         
     | 
| 
       756 
760 
     | 
    
         
             
              }.property('isError').cacheable(),
         
     | 
| 
       757 
     | 
    
         
            -
             
     | 
| 
      
 761 
     | 
    
         
            +
             
     | 
| 
       758 
762 
     | 
    
         
             
              // ...............................
         
     | 
| 
       759 
763 
     | 
    
         
             
              // PRIVATE
         
     | 
| 
       760 
764 
     | 
    
         
             
              //
         
     | 
| 
       761 
     | 
    
         
            -
             
     | 
| 
      
 765 
     | 
    
         
            +
             
     | 
| 
       762 
766 
     | 
    
         
             
              /** @private
         
     | 
| 
       763 
767 
     | 
    
         
             
                Sets the key equal to value.
         
     | 
| 
       764 
768 
     | 
    
         | 
| 
         @@ -781,35 +785,35 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       781 
785 
     | 
    
         | 
| 
       782 
786 
     | 
    
         
             
              /** @private
         
     | 
| 
       783 
787 
     | 
    
         
             
                Creates string representation of record, with status.
         
     | 
| 
       784 
     | 
    
         
            -
             
     | 
| 
      
 788 
     | 
    
         
            +
             
     | 
| 
       785 
789 
     | 
    
         
             
                @returns {String}
         
     | 
| 
       786 
790 
     | 
    
         
             
              */
         
     | 
| 
       787 
     | 
    
         
            -
             
     | 
| 
      
 791 
     | 
    
         
            +
             
     | 
| 
       788 
792 
     | 
    
         
             
              toString: function() {
         
     | 
| 
       789 
793 
     | 
    
         
             
                // We won't use 'readOnlyAttributes' here because accessing them directly
         
     | 
| 
       790 
794 
     | 
    
         
             
                // avoids a SC.clone() -- we'll be careful not to edit anything.
         
     | 
| 
       791 
795 
     | 
    
         
             
                var attrs = this.get('store').readDataHash(this.get('storeKey'));
         
     | 
| 
       792 
796 
     | 
    
         
             
                return "%@(%@) %@".fmt(this.constructor.toString(), SC.inspect(attrs), this.statusString());
         
     | 
| 
       793 
797 
     | 
    
         
             
              },
         
     | 
| 
       794 
     | 
    
         
            -
             
     | 
| 
      
 798 
     | 
    
         
            +
             
     | 
| 
       795 
799 
     | 
    
         
             
              /** @private
         
     | 
| 
       796 
800 
     | 
    
         
             
                Creates string representation of record, with status.
         
     | 
| 
       797 
     | 
    
         
            -
             
     | 
| 
      
 801 
     | 
    
         
            +
             
     | 
| 
       798 
802 
     | 
    
         
             
                @returns {String}
         
     | 
| 
       799 
803 
     | 
    
         
             
              */
         
     | 
| 
       800 
     | 
    
         
            -
             
     | 
| 
      
 804 
     | 
    
         
            +
             
     | 
| 
       801 
805 
     | 
    
         
             
              statusString: function() {
         
     | 
| 
       802 
806 
     | 
    
         
             
                var ret = [], status = this.get('status');
         
     | 
| 
       803 
     | 
    
         
            -
             
     | 
| 
      
 807 
     | 
    
         
            +
             
     | 
| 
       804 
808 
     | 
    
         
             
                for(var prop in SC.Record) {
         
     | 
| 
       805 
809 
     | 
    
         
             
                  if(prop.match(/[A-Z_]$/) && SC.Record[prop]===status) {
         
     | 
| 
       806 
810 
     | 
    
         
             
                    ret.push(prop);
         
     | 
| 
       807 
811 
     | 
    
         
             
                  }
         
     | 
| 
       808 
812 
     | 
    
         
             
                }
         
     | 
| 
       809 
     | 
    
         
            -
             
     | 
| 
      
 813 
     | 
    
         
            +
             
     | 
| 
       810 
814 
     | 
    
         
             
                return ret.join(" ");
         
     | 
| 
       811 
815 
     | 
    
         
             
              },
         
     | 
| 
       812 
     | 
    
         
            -
             
     | 
| 
      
 816 
     | 
    
         
            +
             
     | 
| 
       813 
817 
     | 
    
         
             
              /**
         
     | 
| 
       814 
818 
     | 
    
         
             
                Registers a child record with this parent record.
         
     | 
| 
       815 
819 
     | 
    
         | 
| 
         @@ -824,15 +828,15 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       824 
828 
     | 
    
         
             
               */
         
     | 
| 
       825 
829 
     | 
    
         
             
              registerNestedRecord: function(value, key, path) {
         
     | 
| 
       826 
830 
     | 
    
         
             
                var store, psk, csk, childRecord, recordType;
         
     | 
| 
       827 
     | 
    
         
            -
             
     | 
| 
      
 831 
     | 
    
         
            +
             
     | 
| 
       828 
832 
     | 
    
         
             
                // if no path is entered it must be the key
         
     | 
| 
       829 
833 
     | 
    
         
             
                if (SC.none(path)) path = key;
         
     | 
| 
       830 
     | 
    
         
            -
                // if a record instance is passed, simply use the storeKey.  This allows 
     | 
| 
      
 834 
     | 
    
         
            +
                // if a record instance is passed, simply use the storeKey.  This allows
         
     | 
| 
       831 
835 
     | 
    
         
             
                // you to pass a record from a chained store to get the same record in the
         
     | 
| 
       832 
836 
     | 
    
         
             
                // current store.
         
     | 
| 
       833 
837 
     | 
    
         
             
                if (value && value.get && value.get('isRecord')) {
         
     | 
| 
       834 
838 
     | 
    
         
             
                  childRecord = value;
         
     | 
| 
       835 
     | 
    
         
            -
                } 
     | 
| 
      
 839 
     | 
    
         
            +
                }
         
     | 
| 
       836 
840 
     | 
    
         
             
                else {
         
     | 
| 
       837 
841 
     | 
    
         
             
                  recordType = this._materializeNestedRecordType(value, key);
         
     | 
| 
       838 
842 
     | 
    
         
             
                  childRecord = this.createNestedRecord(recordType, value);
         
     | 
| 
         @@ -844,19 +848,19 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       844 
848 
     | 
    
         
             
                  csk = childRecord.get('storeKey');
         
     | 
| 
       845 
849 
     | 
    
         
             
                  store.registerChildToParent(psk, csk, path);
         
     | 
| 
       846 
850 
     | 
    
         
             
                }
         
     | 
| 
       847 
     | 
    
         
            -
             
     | 
| 
      
 851 
     | 
    
         
            +
             
     | 
| 
       848 
852 
     | 
    
         
             
                return childRecord;
         
     | 
| 
       849 
853 
     | 
    
         
             
              },
         
     | 
| 
       850 
     | 
    
         
            -
             
     | 
| 
      
 854 
     | 
    
         
            +
             
     | 
| 
       851 
855 
     | 
    
         
             
              /**
         
     | 
| 
       852 
856 
     | 
    
         
             
                @private
         
     | 
| 
       853 
     | 
    
         
            -
             
     | 
| 
      
 857 
     | 
    
         
            +
             
     | 
| 
       854 
858 
     | 
    
         
             
                 private method that retrieves the `recordType` from the hash that is
         
     | 
| 
       855 
859 
     | 
    
         
             
                 provided.
         
     | 
| 
       856 
860 
     | 
    
         | 
| 
       857 
861 
     | 
    
         
             
                 Important for use in polymorphism but you must have the following items
         
     | 
| 
       858 
862 
     | 
    
         
             
                 in the parent record:
         
     | 
| 
       859 
     | 
    
         
            -
             
     | 
| 
      
 863 
     | 
    
         
            +
             
     | 
| 
       860 
864 
     | 
    
         
             
                 `nestedRecordNamespace` <= this is the object that has the `SC.Records`
         
     | 
| 
       861 
865 
     | 
    
         
             
                 defined
         
     | 
| 
       862 
866 
     | 
    
         | 
| 
         @@ -888,7 +892,7 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       888 
892 
     | 
    
         | 
| 
       889 
893 
     | 
    
         
             
                return recordType;
         
     | 
| 
       890 
894 
     | 
    
         
             
              },
         
     | 
| 
       891 
     | 
    
         
            -
             
     | 
| 
      
 895 
     | 
    
         
            +
             
     | 
| 
       892 
896 
     | 
    
         
             
              /**
         
     | 
| 
       893 
897 
     | 
    
         
             
                Creates a new nested record instance.
         
     | 
| 
       894 
898 
     | 
    
         | 
| 
         @@ -901,12 +905,12 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       901 
905 
     | 
    
         
             
                var store, id, sk, pk, cr = null, existingId = null;
         
     | 
| 
       902 
906 
     | 
    
         
             
                SC.run(function() {
         
     | 
| 
       903 
907 
     | 
    
         
             
                  hash = hash || {}; // init if needed
         
     | 
| 
       904 
     | 
    
         
            -
             
     | 
| 
      
 908 
     | 
    
         
            +
             
     | 
| 
       905 
909 
     | 
    
         
             
                  existingId = hash[recordType.prototype.primaryKey];
         
     | 
| 
       906 
     | 
    
         
            -
             
     | 
| 
      
 910 
     | 
    
         
            +
             
     | 
| 
       907 
911 
     | 
    
         
             
                  store = this.get('store');
         
     | 
| 
       908 
912 
     | 
    
         
             
                  if (SC.none(store)) throw 'Error: during the creation of a child record: NO STORE ON PARENT!';
         
     | 
| 
       909 
     | 
    
         
            -
             
     | 
| 
      
 913 
     | 
    
         
            +
             
     | 
| 
       910 
914 
     | 
    
         
             
                  if (!id && (pk = recordType.prototype.primaryKey)) {
         
     | 
| 
       911 
915 
     | 
    
         
             
                    id = hash[pk];
         
     | 
| 
       912 
916 
     | 
    
         
             
                    // In case there isnt a primary key supplied then we create on
         
     | 
| 
         @@ -925,9 +929,9 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       925 
929 
     | 
    
         
             
                        hash[pk] = id;
         
     | 
| 
       926 
930 
     | 
    
         
             
                      }
         
     | 
| 
       927 
931 
     | 
    
         
             
                    }
         
     | 
| 
       928 
     | 
    
         
            -
             
     | 
| 
      
 932 
     | 
    
         
            +
             
     | 
| 
       929 
933 
     | 
    
         
             
                  }
         
     | 
| 
       930 
     | 
    
         
            -
             
     | 
| 
      
 934 
     | 
    
         
            +
             
     | 
| 
       931 
935 
     | 
    
         
             
                  // ID processing if necessary
         
     | 
| 
       932 
936 
     | 
    
         
             
                  if (SC.none(existingId) && this.generateIdForChild) this.generateIdForChild(cr);
         
     | 
| 
       933 
937 
     | 
    
         | 
| 
         @@ -935,28 +939,28 @@ SC.Record = SC.Object.extend( 
     | 
|
| 
       935 
939 
     | 
    
         | 
| 
       936 
940 
     | 
    
         
             
                return cr;
         
     | 
| 
       937 
941 
     | 
    
         
             
              },
         
     | 
| 
       938 
     | 
    
         
            -
             
     | 
| 
      
 942 
     | 
    
         
            +
             
     | 
| 
       939 
943 
     | 
    
         
             
              _nestedRecordKey: 0,
         
     | 
| 
       940 
     | 
    
         
            -
             
     | 
| 
      
 944 
     | 
    
         
            +
             
     | 
| 
       941 
945 
     | 
    
         
             
              /**
         
     | 
| 
       942 
     | 
    
         
            -
                Override this function if you want to have a special way of creating 
     | 
| 
      
 946 
     | 
    
         
            +
                Override this function if you want to have a special way of creating
         
     | 
| 
       943 
947 
     | 
    
         
             
                ids for your child records
         
     | 
| 
       944 
     | 
    
         
            -
             
     | 
| 
      
 948 
     | 
    
         
            +
             
     | 
| 
       945 
949 
     | 
    
         
             
                @param {SC.Record} childRecord
         
     | 
| 
       946 
950 
     | 
    
         
             
                @returns {String} the id generated
         
     | 
| 
       947 
951 
     | 
    
         
             
               */
         
     | 
| 
       948 
952 
     | 
    
         
             
              generateIdForChild: function(childRecord){}
         
     | 
| 
       949 
     | 
    
         
            -
             
     | 
| 
      
 953 
     | 
    
         
            +
             
     | 
| 
       950 
954 
     | 
    
         
             
            }) ;
         
     | 
| 
       951 
955 
     | 
    
         | 
| 
       952 
956 
     | 
    
         
             
            // Class Methods
         
     | 
| 
       953 
     | 
    
         
            -
            SC.Record.mixin( /** @scope SC.Record 
     | 
| 
      
 957 
     | 
    
         
            +
            SC.Record.mixin( /** @scope SC.Record */ {
         
     | 
| 
       954 
958 
     | 
    
         | 
| 
       955 
959 
     | 
    
         
             
              /**
         
     | 
| 
       956 
960 
     | 
    
         
             
                Whether to ignore unknown properties when they are being set on the record
         
     | 
| 
       957 
961 
     | 
    
         
             
                object. This is useful if you want to strictly enforce the model schema
         
     | 
| 
       958 
962 
     | 
    
         
             
                and not allow dynamically expanding it by setting new unknown properties
         
     | 
| 
       959 
     | 
    
         
            -
             
     | 
| 
      
 963 
     | 
    
         
            +
             
     | 
| 
       960 
964 
     | 
    
         
             
                @static
         
     | 
| 
       961 
965 
     | 
    
         
             
                @type Boolean
         
     | 
| 
       962 
966 
     | 
    
         
             
                @default NO
         
     | 
| 
         @@ -965,13 +969,13 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       965 
969 
     | 
    
         | 
| 
       966 
970 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       967 
971 
     | 
    
         
             
              // CONSTANTS
         
     | 
| 
       968 
     | 
    
         
            -
              // 
     | 
| 
      
 972 
     | 
    
         
            +
              //
         
     | 
| 
       969 
973 
     | 
    
         | 
| 
       970 
     | 
    
         
            -
              /** 
     | 
| 
      
 974 
     | 
    
         
            +
              /**
         
     | 
| 
       971 
975 
     | 
    
         
             
                Generic state for records with no local changes.
         
     | 
| 
       972 
     | 
    
         
            -
             
     | 
| 
      
 976 
     | 
    
         
            +
             
     | 
| 
       973 
977 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       974 
     | 
    
         
            -
             
     | 
| 
      
 978 
     | 
    
         
            +
             
     | 
| 
       975 
979 
     | 
    
         
             
                @static
         
     | 
| 
       976 
980 
     | 
    
         
             
                @constant
         
     | 
| 
       977 
981 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -979,25 +983,25 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       979 
983 
     | 
    
         
             
              */
         
     | 
| 
       980 
984 
     | 
    
         
             
              CLEAN:            0x0001, // 1
         
     | 
| 
       981 
985 
     | 
    
         | 
| 
       982 
     | 
    
         
            -
              /** 
     | 
| 
      
 986 
     | 
    
         
            +
              /**
         
     | 
| 
       983 
987 
     | 
    
         
             
                Generic state for records with local changes.
         
     | 
| 
       984 
     | 
    
         
            -
             
     | 
| 
      
 988 
     | 
    
         
            +
             
     | 
| 
       985 
989 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       986 
     | 
    
         
            -
             
     | 
| 
      
 990 
     | 
    
         
            +
             
     | 
| 
       987 
991 
     | 
    
         
             
                @static
         
     | 
| 
       988 
992 
     | 
    
         
             
                @constant
         
     | 
| 
       989 
993 
     | 
    
         
             
                @type Number
         
     | 
| 
       990 
994 
     | 
    
         
             
                @default 0x0002
         
     | 
| 
       991 
995 
     | 
    
         
             
              */
         
     | 
| 
       992 
996 
     | 
    
         
             
              DIRTY:            0x0002, // 2
         
     | 
| 
       993 
     | 
    
         
            -
             
     | 
| 
       994 
     | 
    
         
            -
              /** 
     | 
| 
       995 
     | 
    
         
            -
                State for records that are still loaded. 
     | 
| 
       996 
     | 
    
         
            -
             
     | 
| 
       997 
     | 
    
         
            -
                A record instance should never be in this state.  You will only run into 
     | 
| 
       998 
     | 
    
         
            -
                it when working with the low-level data hash API on `SC.Store`. Use a 
     | 
| 
      
 997 
     | 
    
         
            +
             
     | 
| 
      
 998 
     | 
    
         
            +
              /**
         
     | 
| 
      
 999 
     | 
    
         
            +
                State for records that are still loaded.
         
     | 
| 
      
 1000 
     | 
    
         
            +
             
     | 
| 
      
 1001 
     | 
    
         
            +
                A record instance should never be in this state.  You will only run into
         
     | 
| 
      
 1002 
     | 
    
         
            +
                it when working with the low-level data hash API on `SC.Store`. Use a
         
     | 
| 
       999 
1003 
     | 
    
         
             
                logical AND (single `&`) to test record status
         
     | 
| 
       1000 
     | 
    
         
            -
             
     | 
| 
      
 1004 
     | 
    
         
            +
             
     | 
| 
       1001 
1005 
     | 
    
         
             
                @static
         
     | 
| 
       1002 
1006 
     | 
    
         
             
                @constant
         
     | 
| 
       1003 
1007 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1005,23 +1009,23 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1005 
1009 
     | 
    
         
             
              */
         
     | 
| 
       1006 
1010 
     | 
    
         
             
              EMPTY:            0x0100, // 256
         
     | 
| 
       1007 
1011 
     | 
    
         | 
| 
       1008 
     | 
    
         
            -
              /** 
     | 
| 
      
 1012 
     | 
    
         
            +
              /**
         
     | 
| 
       1009 
1013 
     | 
    
         
             
                State for records in an error state.
         
     | 
| 
       1010 
     | 
    
         
            -
             
     | 
| 
      
 1014 
     | 
    
         
            +
             
     | 
| 
       1011 
1015 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1012 
     | 
    
         
            -
             
     | 
| 
      
 1016 
     | 
    
         
            +
             
     | 
| 
       1013 
1017 
     | 
    
         
             
                @static
         
     | 
| 
       1014 
1018 
     | 
    
         
             
                @constant
         
     | 
| 
       1015 
1019 
     | 
    
         
             
                @type Number
         
     | 
| 
       1016 
1020 
     | 
    
         
             
                @default 0x1000
         
     | 
| 
       1017 
1021 
     | 
    
         
             
              */
         
     | 
| 
       1018 
1022 
     | 
    
         
             
              ERROR:            0x1000, // 4096
         
     | 
| 
       1019 
     | 
    
         
            -
             
     | 
| 
       1020 
     | 
    
         
            -
              /** 
     | 
| 
      
 1023 
     | 
    
         
            +
             
     | 
| 
      
 1024 
     | 
    
         
            +
              /**
         
     | 
| 
       1021 
1025 
     | 
    
         
             
                Generic state for records that are loaded and ready for use
         
     | 
| 
       1022 
     | 
    
         
            -
             
     | 
| 
      
 1026 
     | 
    
         
            +
             
     | 
| 
       1023 
1027 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1024 
     | 
    
         
            -
             
     | 
| 
      
 1028 
     | 
    
         
            +
             
     | 
| 
       1025 
1029 
     | 
    
         
             
                @static
         
     | 
| 
       1026 
1030 
     | 
    
         
             
                @constant
         
     | 
| 
       1027 
1031 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1029,11 +1033,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1029 
1033 
     | 
    
         
             
              */
         
     | 
| 
       1030 
1034 
     | 
    
         
             
              READY:            0x0200, // 512
         
     | 
| 
       1031 
1035 
     | 
    
         | 
| 
       1032 
     | 
    
         
            -
              /** 
     | 
| 
      
 1036 
     | 
    
         
            +
              /**
         
     | 
| 
       1033 
1037 
     | 
    
         
             
                State for records that are loaded and ready for use with no local changes
         
     | 
| 
       1034 
     | 
    
         
            -
             
     | 
| 
      
 1038 
     | 
    
         
            +
             
     | 
| 
       1035 
1039 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1036 
     | 
    
         
            -
             
     | 
| 
      
 1040 
     | 
    
         
            +
             
     | 
| 
       1037 
1041 
     | 
    
         
             
                @static
         
     | 
| 
       1038 
1042 
     | 
    
         
             
                @constant
         
     | 
| 
       1039 
1043 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1042,11 +1046,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1042 
1046 
     | 
    
         
             
              READY_CLEAN:      0x0201, // 513
         
     | 
| 
       1043 
1047 
     | 
    
         | 
| 
       1044 
1048 
     | 
    
         | 
| 
       1045 
     | 
    
         
            -
              /** 
     | 
| 
      
 1049 
     | 
    
         
            +
              /**
         
     | 
| 
       1046 
1050 
     | 
    
         
             
                State for records that are loaded and ready for use with local changes
         
     | 
| 
       1047 
     | 
    
         
            -
             
     | 
| 
      
 1051 
     | 
    
         
            +
             
     | 
| 
       1048 
1052 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1049 
     | 
    
         
            -
             
     | 
| 
      
 1053 
     | 
    
         
            +
             
     | 
| 
       1050 
1054 
     | 
    
         
             
                @static
         
     | 
| 
       1051 
1055 
     | 
    
         
             
                @constant
         
     | 
| 
       1052 
1056 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1055,24 +1059,24 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1055 
1059 
     | 
    
         
             
              READY_DIRTY:      0x0202, // 514
         
     | 
| 
       1056 
1060 
     | 
    
         | 
| 
       1057 
1061 
     | 
    
         | 
| 
       1058 
     | 
    
         
            -
              /** 
     | 
| 
      
 1062 
     | 
    
         
            +
              /**
         
     | 
| 
       1059 
1063 
     | 
    
         
             
                State for records that are new - not yet committed to server
         
     | 
| 
       1060 
     | 
    
         
            -
             
     | 
| 
      
 1064 
     | 
    
         
            +
             
     | 
| 
       1061 
1065 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1062 
     | 
    
         
            -
             
     | 
| 
      
 1066 
     | 
    
         
            +
             
     | 
| 
       1063 
1067 
     | 
    
         
             
                @static
         
     | 
| 
       1064 
1068 
     | 
    
         
             
                @constant
         
     | 
| 
       1065 
1069 
     | 
    
         
             
                @type Number
         
     | 
| 
       1066 
1070 
     | 
    
         
             
                @default 0x0203
         
     | 
| 
       1067 
1071 
     | 
    
         
             
              */
         
     | 
| 
       1068 
1072 
     | 
    
         
             
              READY_NEW:        0x0203, // 515
         
     | 
| 
       1069 
     | 
    
         
            -
              
         
     | 
| 
       1070 
1073 
     | 
    
         | 
| 
       1071 
     | 
    
         
            -
             
     | 
| 
      
 1074 
     | 
    
         
            +
             
     | 
| 
      
 1075 
     | 
    
         
            +
              /**
         
     | 
| 
       1072 
1076 
     | 
    
         
             
                Generic state for records that have been destroyed
         
     | 
| 
       1073 
     | 
    
         
            -
             
     | 
| 
      
 1077 
     | 
    
         
            +
             
     | 
| 
       1074 
1078 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1075 
     | 
    
         
            -
             
     | 
| 
      
 1079 
     | 
    
         
            +
             
     | 
| 
       1076 
1080 
     | 
    
         
             
                @static
         
     | 
| 
       1077 
1081 
     | 
    
         
             
                @constant
         
     | 
| 
       1078 
1082 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1081,11 +1085,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1081 
1085 
     | 
    
         
             
              DESTROYED:        0x0400, // 1024
         
     | 
| 
       1082 
1086 
     | 
    
         | 
| 
       1083 
1087 
     | 
    
         | 
| 
       1084 
     | 
    
         
            -
              /** 
     | 
| 
      
 1088 
     | 
    
         
            +
              /**
         
     | 
| 
       1085 
1089 
     | 
    
         
             
                State for records that have been destroyed and committed to server
         
     | 
| 
       1086 
     | 
    
         
            -
             
     | 
| 
      
 1090 
     | 
    
         
            +
             
     | 
| 
       1087 
1091 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1088 
     | 
    
         
            -
             
     | 
| 
      
 1092 
     | 
    
         
            +
             
     | 
| 
       1089 
1093 
     | 
    
         
             
                @static
         
     | 
| 
       1090 
1094 
     | 
    
         
             
                @constant
         
     | 
| 
       1091 
1095 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1094,24 +1098,24 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1094 
1098 
     | 
    
         
             
              DESTROYED_CLEAN:  0x0401, // 1025
         
     | 
| 
       1095 
1099 
     | 
    
         | 
| 
       1096 
1100 
     | 
    
         | 
| 
       1097 
     | 
    
         
            -
              /** 
     | 
| 
      
 1101 
     | 
    
         
            +
              /**
         
     | 
| 
       1098 
1102 
     | 
    
         
             
                State for records that have been destroyed but not yet committed to server
         
     | 
| 
       1099 
     | 
    
         
            -
             
     | 
| 
      
 1103 
     | 
    
         
            +
             
     | 
| 
       1100 
1104 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1101 
     | 
    
         
            -
             
     | 
| 
      
 1105 
     | 
    
         
            +
             
     | 
| 
       1102 
1106 
     | 
    
         
             
                @static
         
     | 
| 
       1103 
1107 
     | 
    
         
             
                @constant
         
     | 
| 
       1104 
1108 
     | 
    
         
             
                @type Number
         
     | 
| 
       1105 
1109 
     | 
    
         
             
                @default 0x0402
         
     | 
| 
       1106 
1110 
     | 
    
         
             
              */
         
     | 
| 
       1107 
1111 
     | 
    
         
             
              DESTROYED_DIRTY:  0x0402, // 1026
         
     | 
| 
       1108 
     | 
    
         
            -
              
         
     | 
| 
       1109 
1112 
     | 
    
         | 
| 
       1110 
     | 
    
         
            -
             
     | 
| 
      
 1113 
     | 
    
         
            +
             
     | 
| 
      
 1114 
     | 
    
         
            +
              /**
         
     | 
| 
       1111 
1115 
     | 
    
         
             
                Generic state for records that have been submitted to data source
         
     | 
| 
       1112 
     | 
    
         
            -
             
     | 
| 
      
 1116 
     | 
    
         
            +
             
     | 
| 
       1113 
1117 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1114 
     | 
    
         
            -
             
     | 
| 
      
 1118 
     | 
    
         
            +
             
     | 
| 
       1115 
1119 
     | 
    
         
             
                @static
         
     | 
| 
       1116 
1120 
     | 
    
         
             
                @constant
         
     | 
| 
       1117 
1121 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1120,11 +1124,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1120 
1124 
     | 
    
         
             
              BUSY:             0x0800, // 2048
         
     | 
| 
       1121 
1125 
     | 
    
         | 
| 
       1122 
1126 
     | 
    
         | 
| 
       1123 
     | 
    
         
            -
              /** 
     | 
| 
      
 1127 
     | 
    
         
            +
              /**
         
     | 
| 
       1124 
1128 
     | 
    
         
             
                State for records that are still loading data from the server
         
     | 
| 
       1125 
     | 
    
         
            -
             
     | 
| 
      
 1129 
     | 
    
         
            +
             
     | 
| 
       1126 
1130 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1127 
     | 
    
         
            -
             
     | 
| 
      
 1131 
     | 
    
         
            +
             
     | 
| 
       1128 
1132 
     | 
    
         
             
                @static
         
     | 
| 
       1129 
1133 
     | 
    
         
             
                @constant
         
     | 
| 
       1130 
1134 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1133,12 +1137,12 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1133 
1137 
     | 
    
         
             
              BUSY_LOADING:     0x0804, // 2052
         
     | 
| 
       1134 
1138 
     | 
    
         | 
| 
       1135 
1139 
     | 
    
         | 
| 
       1136 
     | 
    
         
            -
              /** 
     | 
| 
       1137 
     | 
    
         
            -
                State for new records that were created and submitted to the server; 
     | 
| 
      
 1140 
     | 
    
         
            +
              /**
         
     | 
| 
      
 1141 
     | 
    
         
            +
                State for new records that were created and submitted to the server;
         
     | 
| 
       1138 
1142 
     | 
    
         
             
                waiting on response from server
         
     | 
| 
       1139 
     | 
    
         
            -
             
     | 
| 
      
 1143 
     | 
    
         
            +
             
     | 
| 
       1140 
1144 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1141 
     | 
    
         
            -
             
     | 
| 
      
 1145 
     | 
    
         
            +
             
     | 
| 
       1142 
1146 
     | 
    
         
             
                @static
         
     | 
| 
       1143 
1147 
     | 
    
         
             
                @constant
         
     | 
| 
       1144 
1148 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1147,11 +1151,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1147 
1151 
     | 
    
         
             
              BUSY_CREATING:    0x0808, // 2056
         
     | 
| 
       1148 
1152 
     | 
    
         | 
| 
       1149 
1153 
     | 
    
         | 
| 
       1150 
     | 
    
         
            -
              /** 
     | 
| 
      
 1154 
     | 
    
         
            +
              /**
         
     | 
| 
       1151 
1155 
     | 
    
         
             
                State for records that have been modified and submitted to server
         
     | 
| 
       1152 
     | 
    
         
            -
             
     | 
| 
      
 1156 
     | 
    
         
            +
             
     | 
| 
       1153 
1157 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1154 
     | 
    
         
            -
             
     | 
| 
      
 1158 
     | 
    
         
            +
             
     | 
| 
       1155 
1159 
     | 
    
         
             
                @static
         
     | 
| 
       1156 
1160 
     | 
    
         
             
                @constant
         
     | 
| 
       1157 
1161 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1160,11 +1164,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1160 
1164 
     | 
    
         
             
              BUSY_COMMITTING:  0x0810, // 2064
         
     | 
| 
       1161 
1165 
     | 
    
         | 
| 
       1162 
1166 
     | 
    
         | 
| 
       1163 
     | 
    
         
            -
              /** 
     | 
| 
      
 1167 
     | 
    
         
            +
              /**
         
     | 
| 
       1164 
1168 
     | 
    
         
             
                State for records that have requested a refresh from the server.
         
     | 
| 
       1165 
     | 
    
         
            -
             
     | 
| 
      
 1169 
     | 
    
         
            +
             
     | 
| 
       1166 
1170 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status.
         
     | 
| 
       1167 
     | 
    
         
            -
             
     | 
| 
      
 1171 
     | 
    
         
            +
             
     | 
| 
       1168 
1172 
     | 
    
         
             
                @static
         
     | 
| 
       1169 
1173 
     | 
    
         
             
                @constant
         
     | 
| 
       1170 
1174 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1173,11 +1177,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1173 
1177 
     | 
    
         
             
              BUSY_REFRESH:     0x0820, // 2080
         
     | 
| 
       1174 
1178 
     | 
    
         | 
| 
       1175 
1179 
     | 
    
         | 
| 
       1176 
     | 
    
         
            -
              /** 
     | 
| 
      
 1180 
     | 
    
         
            +
              /**
         
     | 
| 
       1177 
1181 
     | 
    
         
             
                State for records that have requested a refresh from the server.
         
     | 
| 
       1178 
     | 
    
         
            -
             
     | 
| 
      
 1182 
     | 
    
         
            +
             
     | 
| 
       1179 
1183 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1180 
     | 
    
         
            -
             
     | 
| 
      
 1184 
     | 
    
         
            +
             
     | 
| 
       1181 
1185 
     | 
    
         
             
                @static
         
     | 
| 
       1182 
1186 
     | 
    
         
             
                @constant
         
     | 
| 
       1183 
1187 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1185,11 +1189,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1185 
1189 
     | 
    
         
             
              */
         
     | 
| 
       1186 
1190 
     | 
    
         
             
              BUSY_REFRESH_CLEAN:  0x0821, // 2081
         
     | 
| 
       1187 
1191 
     | 
    
         | 
| 
       1188 
     | 
    
         
            -
              /** 
     | 
| 
      
 1192 
     | 
    
         
            +
              /**
         
     | 
| 
       1189 
1193 
     | 
    
         
             
                State for records that have requested a refresh from the server.
         
     | 
| 
       1190 
     | 
    
         
            -
             
     | 
| 
      
 1194 
     | 
    
         
            +
             
     | 
| 
       1191 
1195 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1192 
     | 
    
         
            -
             
     | 
| 
      
 1196 
     | 
    
         
            +
             
     | 
| 
       1193 
1197 
     | 
    
         
             
                @static
         
     | 
| 
       1194 
1198 
     | 
    
         
             
                @constant
         
     | 
| 
       1195 
1199 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1197,11 +1201,11 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1197 
1201 
     | 
    
         
             
              */
         
     | 
| 
       1198 
1202 
     | 
    
         
             
              BUSY_REFRESH_DIRTY:  0x0822, // 2082
         
     | 
| 
       1199 
1203 
     | 
    
         | 
| 
       1200 
     | 
    
         
            -
              /** 
     | 
| 
      
 1204 
     | 
    
         
            +
              /**
         
     | 
| 
       1201 
1205 
     | 
    
         
             
                State for records that have been destroyed and submitted to server
         
     | 
| 
       1202 
     | 
    
         
            -
             
     | 
| 
      
 1206 
     | 
    
         
            +
             
     | 
| 
       1203 
1207 
     | 
    
         
             
                Use a logical AND (single `&`) to test record status
         
     | 
| 
       1204 
     | 
    
         
            -
             
     | 
| 
      
 1208 
     | 
    
         
            +
             
     | 
| 
       1205 
1209 
     | 
    
         
             
                @static
         
     | 
| 
       1206 
1210 
     | 
    
         
             
                @constant
         
     | 
| 
       1207 
1211 
     | 
    
         
             
                @type Number
         
     | 
| 
         @@ -1212,12 +1216,12 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1212 
1216 
     | 
    
         | 
| 
       1213 
1217 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       1214 
1218 
     | 
    
         
             
              // ERRORS
         
     | 
| 
       1215 
     | 
    
         
            -
              // 
     | 
| 
       1216 
     | 
    
         
            -
             
     | 
| 
      
 1219 
     | 
    
         
            +
              //
         
     | 
| 
      
 1220 
     | 
    
         
            +
             
     | 
| 
       1217 
1221 
     | 
    
         
             
              /**
         
     | 
| 
       1218 
     | 
    
         
            -
                Error for when you try to modify a record while it is in a bad 
     | 
| 
      
 1222 
     | 
    
         
            +
                Error for when you try to modify a record while it is in a bad
         
     | 
| 
       1219 
1223 
     | 
    
         
             
                state.
         
     | 
| 
       1220 
     | 
    
         
            -
             
     | 
| 
      
 1224 
     | 
    
         
            +
             
     | 
| 
       1221 
1225 
     | 
    
         
             
                @static
         
     | 
| 
       1222 
1226 
     | 
    
         
             
                @constant
         
     | 
| 
       1223 
1227 
     | 
    
         
             
                @type SC.Error
         
     | 
| 
         @@ -1226,7 +1230,7 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1226 
1230 
     | 
    
         | 
| 
       1227 
1231 
     | 
    
         
             
              /**
         
     | 
| 
       1228 
1232 
     | 
    
         
             
                Error for when you try to create a new record that already exists.
         
     | 
| 
       1229 
     | 
    
         
            -
             
     | 
| 
      
 1233 
     | 
    
         
            +
             
     | 
| 
       1230 
1234 
     | 
    
         
             
                @static
         
     | 
| 
       1231 
1235 
     | 
    
         
             
                @constant
         
     | 
| 
       1232 
1236 
     | 
    
         
             
                @type SC.Error
         
     | 
| 
         @@ -1235,7 +1239,7 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1235 
1239 
     | 
    
         | 
| 
       1236 
1240 
     | 
    
         
             
              /**
         
     | 
| 
       1237 
1241 
     | 
    
         
             
                Error for when you attempt to locate a record that is not found
         
     | 
| 
       1238 
     | 
    
         
            -
             
     | 
| 
      
 1242 
     | 
    
         
            +
             
     | 
| 
       1239 
1243 
     | 
    
         
             
                @static
         
     | 
| 
       1240 
1244 
     | 
    
         
             
                @constant
         
     | 
| 
       1241 
1245 
     | 
    
         
             
                @type SC.Error
         
     | 
| 
         @@ -1244,7 +1248,7 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1244 
1248 
     | 
    
         | 
| 
       1245 
1249 
     | 
    
         
             
              /**
         
     | 
| 
       1246 
1250 
     | 
    
         
             
                Error for when you try to modify a record that is currently busy
         
     | 
| 
       1247 
     | 
    
         
            -
             
     | 
| 
      
 1251 
     | 
    
         
            +
             
     | 
| 
       1248 
1252 
     | 
    
         
             
                @static
         
     | 
| 
       1249 
1253 
     | 
    
         
             
                @constant
         
     | 
| 
       1250 
1254 
     | 
    
         
             
                @type SC.Error
         
     | 
| 
         @@ -1253,54 +1257,54 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1253 
1257 
     | 
    
         | 
| 
       1254 
1258 
     | 
    
         
             
              /**
         
     | 
| 
       1255 
1259 
     | 
    
         
             
                Generic unknown record error
         
     | 
| 
       1256 
     | 
    
         
            -
             
     | 
| 
      
 1260 
     | 
    
         
            +
             
     | 
| 
       1257 
1261 
     | 
    
         
             
                @static
         
     | 
| 
       1258 
1262 
     | 
    
         
             
                @constant
         
     | 
| 
       1259 
1263 
     | 
    
         
             
                @type SC.Error
         
     | 
| 
       1260 
1264 
     | 
    
         
             
              */
         
     | 
| 
       1261 
1265 
     | 
    
         
             
              GENERIC_ERROR:       SC.$error("Generic Error"),
         
     | 
| 
       1262 
     | 
    
         
            -
             
     | 
| 
      
 1266 
     | 
    
         
            +
             
     | 
| 
       1263 
1267 
     | 
    
         
             
              /**
         
     | 
| 
       1264 
1268 
     | 
    
         
             
                @private
         
     | 
| 
       1265 
1269 
     | 
    
         
             
                The next child key to allocate.  A nextChildKey must always be greater than 0.
         
     | 
| 
       1266 
1270 
     | 
    
         
             
              */
         
     | 
| 
       1267 
1271 
     | 
    
         
             
              _nextChildKey: 0,
         
     | 
| 
       1268 
     | 
    
         
            -
             
     | 
| 
      
 1272 
     | 
    
         
            +
             
     | 
| 
       1269 
1273 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       1270 
1274 
     | 
    
         
             
              // CLASS METHODS
         
     | 
| 
       1271 
     | 
    
         
            -
              // 
     | 
| 
       1272 
     | 
    
         
            -
             
     | 
| 
      
 1275 
     | 
    
         
            +
              //
         
     | 
| 
      
 1276 
     | 
    
         
            +
             
     | 
| 
       1273 
1277 
     | 
    
         
             
              /**
         
     | 
| 
       1274 
1278 
     | 
    
         
             
                Helper method returns a new `SC.RecordAttribute` instance to map a simple
         
     | 
| 
       1275 
     | 
    
         
            -
                value or to-one relationship.  At the very least, you should pass the 
     | 
| 
      
 1279 
     | 
    
         
            +
                value or to-one relationship.  At the very least, you should pass the
         
     | 
| 
       1276 
1280 
     | 
    
         
             
                type class you expect the attribute to have.  You may pass any additional
         
     | 
| 
       1277 
1281 
     | 
    
         
             
                options as well.
         
     | 
| 
       1278 
     | 
    
         
            -
             
     | 
| 
       1279 
     | 
    
         
            -
                Use this helper when you define SC.Record subclasses. 
     | 
| 
       1280 
     | 
    
         
            -
             
     | 
| 
      
 1282 
     | 
    
         
            +
             
     | 
| 
      
 1283 
     | 
    
         
            +
                Use this helper when you define SC.Record subclasses.
         
     | 
| 
      
 1284 
     | 
    
         
            +
             
     | 
| 
       1281 
1285 
     | 
    
         
             
                    MyApp.Contact = SC.Record.extend({
         
     | 
| 
       1282 
1286 
     | 
    
         
             
                      firstName: SC.Record.attr(String, { isRequired: YES })
         
     | 
| 
       1283 
1287 
     | 
    
         
             
                    });
         
     | 
| 
       1284 
     | 
    
         
            -
             
     | 
| 
      
 1288 
     | 
    
         
            +
             
     | 
| 
       1285 
1289 
     | 
    
         
             
                @param {Class} type the attribute type
         
     | 
| 
       1286 
1290 
     | 
    
         
             
                @param {Hash} opts the options for the attribute
         
     | 
| 
       1287 
1291 
     | 
    
         
             
                @returns {SC.RecordAttribute} created instance
         
     | 
| 
       1288 
1292 
     | 
    
         
             
              */
         
     | 
| 
       1289 
     | 
    
         
            -
              attr: function(type, opts) { 
     | 
| 
       1290 
     | 
    
         
            -
                return SC.RecordAttribute.attr(type, opts); 
     | 
| 
      
 1293 
     | 
    
         
            +
              attr: function(type, opts) {
         
     | 
| 
      
 1294 
     | 
    
         
            +
                return SC.RecordAttribute.attr(type, opts);
         
     | 
| 
       1291 
1295 
     | 
    
         
             
              },
         
     | 
| 
       1292 
     | 
    
         
            -
             
     | 
| 
      
 1296 
     | 
    
         
            +
             
     | 
| 
       1293 
1297 
     | 
    
         
             
              /**
         
     | 
| 
       1294 
     | 
    
         
            -
                Returns an `SC.RecordAttribute` that describes a fetched attribute.  When 
     | 
| 
      
 1298 
     | 
    
         
            +
                Returns an `SC.RecordAttribute` that describes a fetched attribute.  When
         
     | 
| 
       1295 
1299 
     | 
    
         
             
                you reference this attribute, it will return an `SC.RecordArray` that uses
         
     | 
| 
       1296 
1300 
     | 
    
         
             
                the type as the fetch key and passes the attribute value as a param.
         
     | 
| 
       1297 
     | 
    
         
            -
             
     | 
| 
       1298 
     | 
    
         
            -
                Use this helper when you define SC.Record subclasses. 
     | 
| 
       1299 
     | 
    
         
            -
             
     | 
| 
      
 1301 
     | 
    
         
            +
             
     | 
| 
      
 1302 
     | 
    
         
            +
                Use this helper when you define SC.Record subclasses.
         
     | 
| 
      
 1303 
     | 
    
         
            +
             
     | 
| 
       1300 
1304 
     | 
    
         
             
                    MyApp.Group = SC.Record.extend({
         
     | 
| 
       1301 
1305 
     | 
    
         
             
                      contacts: SC.Record.fetch('MyApp.Contact')
         
     | 
| 
       1302 
1306 
     | 
    
         
             
                    });
         
     | 
| 
       1303 
     | 
    
         
            -
             
     | 
| 
      
 1307 
     | 
    
         
            +
             
     | 
| 
       1304 
1308 
     | 
    
         
             
                @param {SC.Record|String} recordType The type of records to load
         
     | 
| 
       1305 
1309 
     | 
    
         
             
                @param {Hash} opts the options for the attribute
         
     | 
| 
       1306 
1310 
     | 
    
         
             
                @returns {SC.RecordAttribute} created instance
         
     | 
| 
         @@ -1308,22 +1312,22 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1308 
1312 
     | 
    
         
             
              fetch: function(recordType, opts) {
         
     | 
| 
       1309 
1313 
     | 
    
         
             
                return SC.FetchedAttribute.attr(recordType, opts) ;
         
     | 
| 
       1310 
1314 
     | 
    
         
             
              },
         
     | 
| 
       1311 
     | 
    
         
            -
             
     | 
| 
      
 1315 
     | 
    
         
            +
             
     | 
| 
       1312 
1316 
     | 
    
         
             
              /**
         
     | 
| 
       1313 
1317 
     | 
    
         
             
                Will return one of the following:
         
     | 
| 
       1314 
     | 
    
         
            -
             
     | 
| 
       1315 
     | 
    
         
            -
                 1. `SC.ManyAttribute` that describes a record array backed by an 
     | 
| 
       1316 
     | 
    
         
            -
                    array of guids stored in the underlying JSON. 
     | 
| 
      
 1318 
     | 
    
         
            +
             
     | 
| 
      
 1319 
     | 
    
         
            +
                 1. `SC.ManyAttribute` that describes a record array backed by an
         
     | 
| 
      
 1320 
     | 
    
         
            +
                    array of guids stored in the underlying JSON.
         
     | 
| 
       1317 
1321 
     | 
    
         
             
                 2. `SC.ChildrenAttribute` that describes a record array backed by a
         
     | 
| 
       1318 
1322 
     | 
    
         
             
                    array of hashes.
         
     | 
| 
       1319 
     | 
    
         
            -
             
     | 
| 
      
 1323 
     | 
    
         
            +
             
     | 
| 
       1320 
1324 
     | 
    
         
             
                You can edit the contents of this relationship.
         
     | 
| 
       1321 
     | 
    
         
            -
             
     | 
| 
       1322 
     | 
    
         
            -
                For `SC.ManyAttribute`, If you set the inverse and `isMaster: NO` key, 
     | 
| 
       1323 
     | 
    
         
            -
                then editing this array will modify the underlying data, but the 
     | 
| 
       1324 
     | 
    
         
            -
                inverse key on the matching record will also be edited and that 
     | 
| 
      
 1325 
     | 
    
         
            +
             
     | 
| 
      
 1326 
     | 
    
         
            +
                For `SC.ManyAttribute`, If you set the inverse and `isMaster: NO` key,
         
     | 
| 
      
 1327 
     | 
    
         
            +
                then editing this array will modify the underlying data, but the
         
     | 
| 
      
 1328 
     | 
    
         
            +
                inverse key on the matching record will also be edited and that
         
     | 
| 
       1325 
1329 
     | 
    
         
             
                record will be marked as needing a change.
         
     | 
| 
       1326 
     | 
    
         
            -
             
     | 
| 
      
 1330 
     | 
    
         
            +
             
     | 
| 
       1327 
1331 
     | 
    
         
             
                @param {SC.Record|String} recordType The type of record to create
         
     | 
| 
       1328 
1332 
     | 
    
         
             
                @param {Hash} opts the options for the attribute
         
     | 
| 
       1329 
1333 
     | 
    
         
             
                @returns {SC.ManyAttribute|SC.ChildrenAttribute} created instance
         
     | 
| 
         @@ -1340,16 +1344,16 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1340 
1344 
     | 
    
         
             
                }
         
     | 
| 
       1341 
1345 
     | 
    
         
             
                return attr;
         
     | 
| 
       1342 
1346 
     | 
    
         
             
              },
         
     | 
| 
       1343 
     | 
    
         
            -
             
     | 
| 
      
 1347 
     | 
    
         
            +
             
     | 
| 
       1344 
1348 
     | 
    
         
             
              /**
         
     | 
| 
       1345 
1349 
     | 
    
         
             
                Will return one of the following:
         
     | 
| 
       1346 
     | 
    
         
            -
             
     | 
| 
      
 1350 
     | 
    
         
            +
             
     | 
| 
       1347 
1351 
     | 
    
         
             
                 1. `SC.SingleAttribute` that converts the underlying ID to a single
         
     | 
| 
       1348 
1352 
     | 
    
         
             
                    record.  If you modify this property, it will rewrite the underyling
         
     | 
| 
       1349 
1353 
     | 
    
         
             
                    ID. It will also modify the inverse of the relationship, if you set it.
         
     | 
| 
       1350 
1354 
     | 
    
         
             
                 2. `SC.ChildAttribute` that you can edit the contents
         
     | 
| 
       1351 
1355 
     | 
    
         
             
                    of this relationship.
         
     | 
| 
       1352 
     | 
    
         
            -
             
     | 
| 
      
 1356 
     | 
    
         
            +
             
     | 
| 
       1353 
1357 
     | 
    
         
             
                @param {SC.Record|String} recordType the type of the record to create
         
     | 
| 
       1354 
1358 
     | 
    
         
             
                @param {Hash} opts additional options
         
     | 
| 
       1355 
1359 
     | 
    
         
             
                @returns {SC.SingleAttribute|SC.ChildAttribute} created instance
         
     | 
| 
         @@ -1366,12 +1370,12 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1366 
1370 
     | 
    
         
             
                }
         
     | 
| 
       1367 
1371 
     | 
    
         
             
                return attr;
         
     | 
| 
       1368 
1372 
     | 
    
         
             
              },
         
     | 
| 
       1369 
     | 
    
         
            -
             
     | 
| 
      
 1373 
     | 
    
         
            +
             
     | 
| 
       1370 
1374 
     | 
    
         
             
              /**
         
     | 
| 
       1371 
1375 
     | 
    
         
             
                Returns all storeKeys mapped by Id for this record type.  This method is
         
     | 
| 
       1372 
1376 
     | 
    
         
             
                used mostly by the `SC.Store` and the Record to coordinate.  You will rarely
         
     | 
| 
       1373 
1377 
     | 
    
         
             
                need to call this method yourself.
         
     | 
| 
       1374 
     | 
    
         
            -
             
     | 
| 
      
 1378 
     | 
    
         
            +
             
     | 
| 
       1375 
1379 
     | 
    
         
             
                @returns {Hash}
         
     | 
| 
       1376 
1380 
     | 
    
         
             
              */
         
     | 
| 
       1377 
1381 
     | 
    
         
             
              storeKeysById: function() {
         
     | 
| 
         @@ -1380,50 +1384,50 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1380 
1384 
     | 
    
         
             
                if (!ret) ret = this[key] = {};
         
     | 
| 
       1381 
1385 
     | 
    
         
             
                return ret;
         
     | 
| 
       1382 
1386 
     | 
    
         
             
              },
         
     | 
| 
       1383 
     | 
    
         
            -
             
     | 
| 
      
 1387 
     | 
    
         
            +
             
     | 
| 
       1384 
1388 
     | 
    
         
             
              /**
         
     | 
| 
       1385 
1389 
     | 
    
         
             
                Given a primaryKey value for the record, returns the associated
         
     | 
| 
       1386 
     | 
    
         
            -
                storeKey.  If the primaryKey has not been assigned a storeKey yet, it 
     | 
| 
      
 1390 
     | 
    
         
            +
                storeKey.  If the primaryKey has not been assigned a storeKey yet, it
         
     | 
| 
       1387 
1391 
     | 
    
         
             
                will be added.
         
     | 
| 
       1388 
     | 
    
         
            -
             
     | 
| 
       1389 
     | 
    
         
            -
                For the inverse of this method see `SC.Store.idFor()` and 
     | 
| 
      
 1392 
     | 
    
         
            +
             
     | 
| 
      
 1393 
     | 
    
         
            +
                For the inverse of this method see `SC.Store.idFor()` and
         
     | 
| 
       1390 
1394 
     | 
    
         
             
                `SC.Store.recordTypeFor()`.
         
     | 
| 
       1391 
     | 
    
         
            -
             
     | 
| 
      
 1395 
     | 
    
         
            +
             
     | 
| 
       1392 
1396 
     | 
    
         
             
                @param {String} id a record id
         
     | 
| 
       1393 
1397 
     | 
    
         
             
                @returns {Number} a storeKey.
         
     | 
| 
       1394 
1398 
     | 
    
         
             
              */
         
     | 
| 
       1395 
1399 
     | 
    
         
             
              storeKeyFor: function(id) {
         
     | 
| 
       1396 
1400 
     | 
    
         
             
                var storeKeys = this.storeKeysById(),
         
     | 
| 
       1397 
1401 
     | 
    
         
             
                    ret       = storeKeys[id];
         
     | 
| 
       1398 
     | 
    
         
            -
             
     | 
| 
      
 1402 
     | 
    
         
            +
             
     | 
| 
       1399 
1403 
     | 
    
         
             
                if (!ret) {
         
     | 
| 
       1400 
1404 
     | 
    
         
             
                  ret = SC.Store.generateStoreKey();
         
     | 
| 
       1401 
1405 
     | 
    
         
             
                  SC.Store.idsByStoreKey[ret] = id ;
         
     | 
| 
       1402 
1406 
     | 
    
         
             
                  SC.Store.recordTypesByStoreKey[ret] = this ;
         
     | 
| 
       1403 
1407 
     | 
    
         
             
                  storeKeys[id] = ret ;
         
     | 
| 
       1404 
1408 
     | 
    
         
             
                }
         
     | 
| 
       1405 
     | 
    
         
            -
             
     | 
| 
      
 1409 
     | 
    
         
            +
             
     | 
| 
       1406 
1410 
     | 
    
         
             
                return ret ;
         
     | 
| 
       1407 
1411 
     | 
    
         
             
              },
         
     | 
| 
       1408 
     | 
    
         
            -
             
     | 
| 
      
 1412 
     | 
    
         
            +
             
     | 
| 
       1409 
1413 
     | 
    
         
             
              /**
         
     | 
| 
       1410 
1414 
     | 
    
         
             
                Given a primaryKey value for the record, returns the associated
         
     | 
| 
       1411 
1415 
     | 
    
         
             
                storeKey.  As opposed to `storeKeyFor()` however, this method
         
     | 
| 
       1412 
1416 
     | 
    
         
             
                will NOT generate a new storeKey but returned undefined.
         
     | 
| 
       1413 
     | 
    
         
            -
             
     | 
| 
      
 1417 
     | 
    
         
            +
             
     | 
| 
       1414 
1418 
     | 
    
         
             
                @param {String} id a record id
         
     | 
| 
       1415 
1419 
     | 
    
         
             
                @returns {Number} a storeKey.
         
     | 
| 
       1416 
1420 
     | 
    
         
             
              */
         
     | 
| 
       1417 
1421 
     | 
    
         
             
              storeKeyExists: function(id) {
         
     | 
| 
       1418 
1422 
     | 
    
         
             
                var storeKeys = this.storeKeysById(),
         
     | 
| 
       1419 
1423 
     | 
    
         
             
                    ret       = storeKeys[id];
         
     | 
| 
       1420 
     | 
    
         
            -
             
     | 
| 
      
 1424 
     | 
    
         
            +
             
     | 
| 
       1421 
1425 
     | 
    
         
             
                return ret ;
         
     | 
| 
       1422 
1426 
     | 
    
         
             
              },
         
     | 
| 
       1423 
1427 
     | 
    
         | 
| 
       1424 
     | 
    
         
            -
              /** 
     | 
| 
      
 1428 
     | 
    
         
            +
              /**
         
     | 
| 
       1425 
1429 
     | 
    
         
             
                Returns a record with the named ID in store.
         
     | 
| 
       1426 
     | 
    
         
            -
             
     | 
| 
      
 1430 
     | 
    
         
            +
             
     | 
| 
       1427 
1431 
     | 
    
         
             
                @param {SC.Store} store the store
         
     | 
| 
       1428 
1432 
     | 
    
         
             
                @param {String} id the record id or a query
         
     | 
| 
       1429 
1433 
     | 
    
         
             
                @returns {SC.Record} record instance
         
     | 
| 
         @@ -1431,7 +1435,7 @@ SC.Record.mixin( /** @scope SC.Record.prototype */ { 
     | 
|
| 
       1431 
1435 
     | 
    
         
             
              find: function(store, id) {
         
     | 
| 
       1432 
1436 
     | 
    
         
             
                return store.find(this, id);
         
     | 
| 
       1433 
1437 
     | 
    
         
             
              },
         
     | 
| 
       1434 
     | 
    
         
            -
             
     | 
| 
      
 1438 
     | 
    
         
            +
             
     | 
| 
       1435 
1439 
     | 
    
         
             
              /** @private - enhance extend to notify SC.Query as well. */
         
     | 
| 
       1436 
1440 
     | 
    
         
             
              extend: function() {
         
     | 
| 
       1437 
1441 
     | 
    
         
             
                var ret = SC.Object.extend.apply(this, arguments);
         
     |