datts_right 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datts_right (0.0.15)
4
+ datts_right (0.0.16)
5
5
  datts_right
6
6
  rails (>= 3.0.0)
7
7
 
data/README.textile CHANGED
@@ -149,6 +149,10 @@ You can access all that other information this way:
149
149
  pre. @page.dynamic_attribute_details(:price).definer[:name] # "Price"
150
150
  @page.dynamic_attribute_details(:price).definer[:description] # "How much this will cost."
151
151
 
152
+ h3. create_defitions!
153
+
154
+ You can call @create_definitions!@ on a model if you later on add the ability for that model to be a definer. For example, if you first start your Category without @has_dynamic_attributes :definition => true@, then later on you install datts_right, and you want Category to have a definition, you first add @has_dynamic_attributes :definition => true@ to Category, then you call @Category.create_definitions!@
155
+
152
156
  h2. Stuff that make things faster
153
157
 
154
158
  The dynamic attributes are only actually saved when save is called on the record that has them.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.16
1
+ 0.0.17
data/datts_right.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datts_right}
8
- s.version = "0.0.16"
8
+ s.version = "0.0.17"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ramon Tayag"]
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
40
40
  "spec/datt_spec.rb",
41
41
  "spec/datts_right/add_dynamic_attributes_spec.rb",
42
42
  "spec/datts_right/attributes_spec.rb",
43
+ "spec/datts_right/create_definitions_spec.rb",
43
44
  "spec/datts_right/dynamic_attribute_definition_spec.rb",
44
45
  "spec/datts_right/inheritance_spec.rb",
45
46
  "spec/datts_right/remove_dynamic_attribute_spec.rb",
@@ -55,6 +56,7 @@ Gem::Specification.new do |s|
55
56
  "spec/datt_spec.rb",
56
57
  "spec/datts_right/add_dynamic_attributes_spec.rb",
57
58
  "spec/datts_right/attributes_spec.rb",
59
+ "spec/datts_right/create_definitions_spec.rb",
58
60
  "spec/datts_right/dynamic_attribute_definition_spec.rb",
59
61
  "spec/datts_right/inheritance_spec.rb",
60
62
  "spec/datts_right/remove_dynamic_attribute_spec.rb",
@@ -243,6 +245,18 @@ Gem::Specification.new do |s|
243
245
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
244
246
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
245
247
  s.add_development_dependency(%q<rcov>, [">= 0"])
248
+ s.add_development_dependency(%q<autotest>, [">= 0"])
249
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
250
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
251
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
252
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
253
+ s.add_development_dependency(%q<rcov>, [">= 0"])
254
+ s.add_development_dependency(%q<autotest>, [">= 0"])
255
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
256
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
257
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
258
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
259
+ s.add_development_dependency(%q<rcov>, [">= 0"])
246
260
  else
247
261
  s.add_dependency(%q<datts_right>, [">= 0"])
248
262
  s.add_dependency(%q<rails>, [">= 3.0.0"])
@@ -421,6 +435,18 @@ Gem::Specification.new do |s|
421
435
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
422
436
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
423
437
  s.add_dependency(%q<rcov>, [">= 0"])
438
+ s.add_dependency(%q<autotest>, [">= 0"])
439
+ s.add_dependency(%q<sqlite3>, [">= 0"])
440
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
441
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
442
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
443
+ s.add_dependency(%q<rcov>, [">= 0"])
444
+ s.add_dependency(%q<autotest>, [">= 0"])
445
+ s.add_dependency(%q<sqlite3>, [">= 0"])
446
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
447
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
448
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
449
+ s.add_dependency(%q<rcov>, [">= 0"])
424
450
  end
425
451
  else
426
452
  s.add_dependency(%q<datts_right>, [">= 0"])
@@ -600,6 +626,18 @@ Gem::Specification.new do |s|
600
626
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
601
627
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
602
628
  s.add_dependency(%q<rcov>, [">= 0"])
629
+ s.add_dependency(%q<autotest>, [">= 0"])
630
+ s.add_dependency(%q<sqlite3>, [">= 0"])
631
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
632
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
633
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
634
+ s.add_dependency(%q<rcov>, [">= 0"])
635
+ s.add_dependency(%q<autotest>, [">= 0"])
636
+ s.add_dependency(%q<sqlite3>, [">= 0"])
637
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
638
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
639
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
640
+ s.add_dependency(%q<rcov>, [">= 0"])
603
641
  end
604
642
  end
605
643
 
@@ -65,6 +65,16 @@ module DattsRight
65
65
  results
66
66
  }
67
67
 
68
+ # Used when you have already existing records that have don't have definitions, and you want them to
69
+ def self.create_definitions!
70
+ self.all.each do |record|
71
+ puts "Called create_definitions! on #{record.inspect}. Its dynamic_attribute_definition (if it has one: #{record.dynamic_attribute_definition.inspect})"
72
+ record.dynamic_attribute_definition.create if dynamic_attributes_options[:definition] && record.dynamic_attribute_definition.nil?
73
+ end
74
+ end
75
+
76
+ private
77
+
68
78
  def self.method_missing(method_id, *arguments)
69
79
  # TODO better way to hook this into the rails code, and not define my own
70
80
  begin # Prioritize ActiveRecord's method_missing
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe DattsRight, ".create_definitions!" do
4
+ it "should create definitions for all existing records, if the definition does not exist" do
5
+ 2.times do
6
+ Category.create.destroy.dynamic_attribute_definition
7
+ end
8
+ Category.create_definitions!
9
+ Category.all.each do |c|
10
+ c.dynamic_attribute_definition.should_not be_nil
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datts_right
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 61
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 16
10
- version: 0.0.16
9
+ - 17
10
+ version: 0.0.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ramon Tayag
@@ -2674,6 +2674,186 @@ dependencies:
2674
2674
  name: rcov
2675
2675
  version_requirements: *id177
2676
2676
  prerelease: false
2677
+ - !ruby/object:Gem::Dependency
2678
+ type: :development
2679
+ requirement: &id178 !ruby/object:Gem::Requirement
2680
+ none: false
2681
+ requirements:
2682
+ - - ">="
2683
+ - !ruby/object:Gem::Version
2684
+ hash: 3
2685
+ segments:
2686
+ - 0
2687
+ version: "0"
2688
+ name: autotest
2689
+ version_requirements: *id178
2690
+ prerelease: false
2691
+ - !ruby/object:Gem::Dependency
2692
+ type: :development
2693
+ requirement: &id179 !ruby/object:Gem::Requirement
2694
+ none: false
2695
+ requirements:
2696
+ - - ">="
2697
+ - !ruby/object:Gem::Version
2698
+ hash: 3
2699
+ segments:
2700
+ - 0
2701
+ version: "0"
2702
+ name: sqlite3
2703
+ version_requirements: *id179
2704
+ prerelease: false
2705
+ - !ruby/object:Gem::Dependency
2706
+ type: :development
2707
+ requirement: &id180 !ruby/object:Gem::Requirement
2708
+ none: false
2709
+ requirements:
2710
+ - - ~>
2711
+ - !ruby/object:Gem::Version
2712
+ hash: 3
2713
+ segments:
2714
+ - 2
2715
+ - 3
2716
+ - 0
2717
+ version: 2.3.0
2718
+ name: rspec
2719
+ version_requirements: *id180
2720
+ prerelease: false
2721
+ - !ruby/object:Gem::Dependency
2722
+ type: :development
2723
+ requirement: &id181 !ruby/object:Gem::Requirement
2724
+ none: false
2725
+ requirements:
2726
+ - - ~>
2727
+ - !ruby/object:Gem::Version
2728
+ hash: 23
2729
+ segments:
2730
+ - 1
2731
+ - 0
2732
+ - 0
2733
+ version: 1.0.0
2734
+ name: bundler
2735
+ version_requirements: *id181
2736
+ prerelease: false
2737
+ - !ruby/object:Gem::Dependency
2738
+ type: :development
2739
+ requirement: &id182 !ruby/object:Gem::Requirement
2740
+ none: false
2741
+ requirements:
2742
+ - - ~>
2743
+ - !ruby/object:Gem::Version
2744
+ hash: 7
2745
+ segments:
2746
+ - 1
2747
+ - 5
2748
+ - 2
2749
+ version: 1.5.2
2750
+ name: jeweler
2751
+ version_requirements: *id182
2752
+ prerelease: false
2753
+ - !ruby/object:Gem::Dependency
2754
+ type: :development
2755
+ requirement: &id183 !ruby/object:Gem::Requirement
2756
+ none: false
2757
+ requirements:
2758
+ - - ">="
2759
+ - !ruby/object:Gem::Version
2760
+ hash: 3
2761
+ segments:
2762
+ - 0
2763
+ version: "0"
2764
+ name: rcov
2765
+ version_requirements: *id183
2766
+ prerelease: false
2767
+ - !ruby/object:Gem::Dependency
2768
+ type: :development
2769
+ requirement: &id184 !ruby/object:Gem::Requirement
2770
+ none: false
2771
+ requirements:
2772
+ - - ">="
2773
+ - !ruby/object:Gem::Version
2774
+ hash: 3
2775
+ segments:
2776
+ - 0
2777
+ version: "0"
2778
+ name: autotest
2779
+ version_requirements: *id184
2780
+ prerelease: false
2781
+ - !ruby/object:Gem::Dependency
2782
+ type: :development
2783
+ requirement: &id185 !ruby/object:Gem::Requirement
2784
+ none: false
2785
+ requirements:
2786
+ - - ">="
2787
+ - !ruby/object:Gem::Version
2788
+ hash: 3
2789
+ segments:
2790
+ - 0
2791
+ version: "0"
2792
+ name: sqlite3
2793
+ version_requirements: *id185
2794
+ prerelease: false
2795
+ - !ruby/object:Gem::Dependency
2796
+ type: :development
2797
+ requirement: &id186 !ruby/object:Gem::Requirement
2798
+ none: false
2799
+ requirements:
2800
+ - - ~>
2801
+ - !ruby/object:Gem::Version
2802
+ hash: 3
2803
+ segments:
2804
+ - 2
2805
+ - 3
2806
+ - 0
2807
+ version: 2.3.0
2808
+ name: rspec
2809
+ version_requirements: *id186
2810
+ prerelease: false
2811
+ - !ruby/object:Gem::Dependency
2812
+ type: :development
2813
+ requirement: &id187 !ruby/object:Gem::Requirement
2814
+ none: false
2815
+ requirements:
2816
+ - - ~>
2817
+ - !ruby/object:Gem::Version
2818
+ hash: 23
2819
+ segments:
2820
+ - 1
2821
+ - 0
2822
+ - 0
2823
+ version: 1.0.0
2824
+ name: bundler
2825
+ version_requirements: *id187
2826
+ prerelease: false
2827
+ - !ruby/object:Gem::Dependency
2828
+ type: :development
2829
+ requirement: &id188 !ruby/object:Gem::Requirement
2830
+ none: false
2831
+ requirements:
2832
+ - - ~>
2833
+ - !ruby/object:Gem::Version
2834
+ hash: 7
2835
+ segments:
2836
+ - 1
2837
+ - 5
2838
+ - 2
2839
+ version: 1.5.2
2840
+ name: jeweler
2841
+ version_requirements: *id188
2842
+ prerelease: false
2843
+ - !ruby/object:Gem::Dependency
2844
+ type: :development
2845
+ requirement: &id189 !ruby/object:Gem::Requirement
2846
+ none: false
2847
+ requirements:
2848
+ - - ">="
2849
+ - !ruby/object:Gem::Version
2850
+ hash: 3
2851
+ segments:
2852
+ - 0
2853
+ version: "0"
2854
+ name: rcov
2855
+ version_requirements: *id189
2856
+ prerelease: false
2677
2857
  description: Creates a separate table that saves all your dynamic attributes.
2678
2858
  email: ramon@tayag.net
2679
2859
  executables: []
@@ -2707,6 +2887,7 @@ files:
2707
2887
  - spec/datt_spec.rb
2708
2888
  - spec/datts_right/add_dynamic_attributes_spec.rb
2709
2889
  - spec/datts_right/attributes_spec.rb
2890
+ - spec/datts_right/create_definitions_spec.rb
2710
2891
  - spec/datts_right/dynamic_attribute_definition_spec.rb
2711
2892
  - spec/datts_right/inheritance_spec.rb
2712
2893
  - spec/datts_right/remove_dynamic_attribute_spec.rb
@@ -2750,6 +2931,7 @@ test_files:
2750
2931
  - spec/datt_spec.rb
2751
2932
  - spec/datts_right/add_dynamic_attributes_spec.rb
2752
2933
  - spec/datts_right/attributes_spec.rb
2934
+ - spec/datts_right/create_definitions_spec.rb
2753
2935
  - spec/datts_right/dynamic_attribute_definition_spec.rb
2754
2936
  - spec/datts_right/inheritance_spec.rb
2755
2937
  - spec/datts_right/remove_dynamic_attribute_spec.rb