Sha256: 831ebb16a8f456d859b74d19c1b2dc86c9cee4af3629f2ad0e0a64a900ba7e1c
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
## # MongoMapper adapter to ExtJS::Model mixin # module ExtJS module Model ## # ClassMethods # module ClassMethods def extjs_primary_key :_id end def extjs_column_names self.column_names end def extjs_columns_hash self.keys end def extjs_associations if @extjs_associations.nil? @extjs_associations = {} self.associations.keys.each do |key| @extjs_associations[key.to_sym] = { :name => key, :type => self.associations[key].type, :class => self.associations[key].class_name.constantize, :foreign_key => self.associations[key].foreign_key, :is_polymorphic => false # <-- no impl. for MM is_polymorhpic yet. Anyone care to implement this? } end end @extjs_associations end def extjs_type(col) type = col.type.to_s case type when "DateTime", "Date", "Time" type = :date when "String" type = :string when "Float" type = :float when "Integer", "BigDecimal" type = :int else type = "auto" end end def extjs_allow_blank(col) (col.name == '_id') || (col.options[:required] != true) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
extjs-mvc-0.3.0 | lib/model/mongo_mapper.rb |