extjs-mvc 0.1.17 → 0.1.18

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/active_record/model.rb +12 -7
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.17
1
+ 0.1.18
@@ -3,6 +3,10 @@ module ExtJS
3
3
  def self.included(model)
4
4
  model.send(:extend, ClassMethods)
5
5
  model.send(:include, InstanceMethods)
6
+ model.class_eval do
7
+ cattr_accessor :extjs_record_fields
8
+ end
9
+ model.extjs_record_fields = []
6
10
  end
7
11
 
8
12
  ##
@@ -21,7 +25,6 @@ module ExtJS
21
25
  # ClassMethods
22
26
  #
23
27
  module ClassMethods
24
- @@fields = []
25
28
  ##
26
29
  # Defines the subset of AR columns used to create Ext.data.Record def'n.
27
30
  # @param {Array/Hash} list-of-fields to include, :only, or :exclude
@@ -30,14 +33,14 @@ module ExtJS
30
33
  options = params.extract_options!
31
34
  if !options.keys.empty?
32
35
  if options[:only]
33
- @@fields = options[:only]
36
+ self.extjs_record_fields = options[:only]
34
37
  elsif options[:exclude]
35
- @@fields = self.columns.reject {|c| options[:exclude].find {|ex| c.name.to_sym === ex}}.collect {|c| c.name.to_sym}
38
+ self.extjs_record_fields = self.columns.reject {|c| options[:exclude].find {|ex| c.name.to_sym === ex}}.collect {|c| c.name.to_sym}
36
39
  end
37
40
  elsif !params.empty?
38
- @@fields = params
41
+ self.extjs_record_fields = params
39
42
  else
40
- @@fields
43
+ self.extjs_record_fields
41
44
  end
42
45
  end
43
46
 
@@ -46,10 +49,12 @@ module ExtJS
46
49
  # eg: {name:'foo', type: 'string'}
47
50
  #
48
51
  def extjs_record
49
- @@fields = self.columns.collect {|c| c.name.to_sym } if @@fields.empty?
52
+ self.extjs_record_fields = self.columns.collect {|c| c.name.to_sym } if self.extjs_record_fields.empty?
50
53
  {
51
- "fields" => @@fields.collect {|f|
54
+ "fields" => extjs_record_fields.collect {|f|
52
55
  col = self.columns.find {|c| c.name.to_sym === f}
56
+ puts "COL: " + col.to_s
57
+
53
58
  type = col.type
54
59
  case col.type
55
60
  when :datetime || :date || :time || :timestamp
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extjs-mvc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Scott