Module ExtJS::Model::ClassMethods
In: lib/model/data_mapper.rb
lib/model/base.rb
lib/model/mongo_mapper.rb
lib/model/active_record.rb

Methods

Public Instance methods

determine if supplied Column object is nullable @param {ActiveRecord::ConnectionAdapters::Column} @return {Boolean}

return a simple, normalized list of AR associations having the :name, :type and association class @return {Array}

returns the default value @param {ActiveRecord::ConnectionAdapters::Column} @return {Mixed}

Render a column-config object @param {Hash/Column} field Field-configuration Hash, probably has :name already set and possibly Ext.data.Field options. @param {ORM Column Object from AR, DM or MM}

shortcut to define the default fieldset. For backwards-compatibility.

meant to be used within a Model to define the extjs record fields. eg: class User

  extjs_fieldset :grid, [:first, :last, :email => {"sortDir" => "ASC"}, :company => [:id, :name]]

end or class User

  extjs_fieldset :last, :email => {"sortDir" => "ASC"}, :company => [:id, :name] # => implies fieldset name :default

end

returns the corresponding column name of the type column for a polymorphic association @param {String/Symbol} the id column name for this association @return {Symbol}

render AR columns to Ext.data.Record.create format eg: {name:’foo’, type: ‘string’}

The first parameter should be the fieldset for which the record definition will be returned. If no parameter is provided, then the default fieldset will be choosen Alternativly the first parameter can be a Hash with a :fields member to directly specify the fields to use for the record config.

All these are valid calls:

 User.extjs_record             # returns record config for :default fieldset
                               # (fieldset is autmatically defined, if not set)

 User.extjs_record :fieldset   # returns record config for :fieldset fieldset
                               # (fieldset is autmatically defined, if not set)

 User.extjs_record :fields => [:id, :password]
                               # returns record config for the fields 'id' and 'password'

For even more valid options for this method (which all should not be neccessary to use) have a look at ExtJS::Model::Util.extract_fieldset_and_options

determine datatype of supplied Column object @param {ActiveRecord::ConnectionAdapters::Column} @return {String}

Prepare a field configuration list into a normalized array of Hashes, {:name => "field_name"} @param {Mixed} params @return {Array} of Hashes

[Validate]