Sha256: f4abcf4ba52ef6a6aed8f9fb454b379b0404d954acc32b7a51849585ee47f40d

Contents?: true

Size: 864 Bytes

Versions: 3

Compression:

Stored size: 864 Bytes

Contents

Ext.define('<%= app_name %>.model.<%= singular_table_name.capitalize %>', {
	extend: 'Ext.data.Model',
	mixins: {
		updateable: '<%= app_name %>.ux.data.Updateable'
	},
	
	fields: [
		{ name: 'id', type: 'int' }
		<% attributes.each_with_index do |attribute, index| %>
			,{<%= create_ext_record(attribute) -%>}
			<% if attribute.reference? -%>
      ,{name: '<%= attribute.name %>_id'}
			<% end %>
		<% end %>
	],
	
	proxy: {
		type: 'rails',
		url: '/<%= plural_table_name %>',
		format: 'json',
		addActions: {
			destroy_all: {
				method: 'POST',
				collection: true
			},
			update_all: {
				method: 'POST',
				collection: true
			}
		},
		reader: {
			type: 'json',
			root: '<%= singular_table_name %>'
		},
		writer: {
			type: 'json',
			root: '<%= singular_table_name %>',
			encode: true,
			writeAllFields: true,
			allowSingle: false
		}
	}
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
extjs_scaffold-0.2.1 lib/generators/extjs_scaffold/scaffold_controller/templates/js/Model.js
extjs_scaffold-0.2.0 lib/generators/extjs_scaffold/scaffold_controller/templates/js/Model.js
extjs_scaffold-0.1.1 lib/generators/extjs_scaffold/scaffold_controller/templates/js/Model.js