sequel_model 0.5 → 0.5.0.1

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.5.0.1 (2008-03-09)
2
+
3
+ * Fixed Model.associate to accept class and class name in :class option.
4
+
1
5
  === 0.5 (2008-03-08)
2
6
 
3
7
  * Merged new associations branch into trunk.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ include FileUtils
9
9
  # Configuration
10
10
  ##############################################################################
11
11
  NAME = "sequel_model"
12
- VERS = "0.5"
12
+ VERS = "0.5.0.1"
13
13
  CLEAN.include ["**/.*.sw?", "pkg/*", ".config", "doc/*", "coverage/*"]
14
14
  RDOC_OPTS = [
15
15
  "--quiet",
@@ -80,12 +80,9 @@ module Sequel::Model::Associations
80
80
  #
81
81
  # The following options can be supplied:
82
82
  # * *ALL types*:
83
- # - :class_name - The name of the associated class as a string. If not
83
+ # - :class - The associated class or its name. If not
84
84
  # given, uses the association's name, which is camelized (and
85
85
  # singularized if type is :{one,many}_to_many)
86
- # - :class - The associated class itself. Simpler than using
87
- # :class_name, but can't be used always due to dependencies not being
88
- # loaded.
89
86
  # * :many_to_one:
90
87
  # - :key - foreign_key in current model's table that references
91
88
  # associated model's primary key, as a symbol. Defaults to :"#{name}_id".
@@ -117,7 +114,7 @@ module Sequel::Model::Associations
117
114
  end
118
115
 
119
116
  # prepare options
120
- opts[:class_name] ||= opts[:class].name if opts[:class]
117
+ opts[:class_name] ||= opts[:class].to_s if opts[:class]
121
118
  opts = association_reflections[name] = opts.merge(:type => type, :name => name, :block => block)
122
119
 
123
120
  send(:"def_#{type}", name, opts)
@@ -150,9 +150,8 @@ describe Sequel::Model, "one_to_many" do
150
150
  @c2 = Class.new(Sequel::Model(:nodes)) do
151
151
  attr_accessor :xxx
152
152
 
153
- def self.name
154
- 'Node'
155
- end
153
+ def self.name; 'Node'; end
154
+ def self.to_s; 'Node'; end
156
155
  end
157
156
  @dataset = @c2.dataset
158
157
 
@@ -353,17 +352,15 @@ describe Sequel::Model, "many_to_many" do
353
352
  MODEL_DB.reset
354
353
 
355
354
  @c1 = Class.new(Sequel::Model(:attributes)) do
356
- def self.name
357
- 'Attribute'
358
- end
355
+ def self.name; 'Attribute'; end
356
+ def self.to_s; 'Attribute'; end
359
357
  end
360
358
 
361
359
  @c2 = Class.new(Sequel::Model(:nodes)) do
362
360
  attr_accessor :xxx
363
361
 
364
- def self.name
365
- 'Node'
366
- end
362
+ def self.name; 'Node'; end
363
+ def self.to_s; 'Node'; end
367
364
  end
368
365
  @dataset = @c2.dataset
369
366
 
@@ -546,9 +543,8 @@ describe Sequel::Model, "all_association_reflections" do
546
543
  before(:each) do
547
544
  MODEL_DB.reset
548
545
  @c1 = Class.new(Sequel::Model(:nodes)) do
549
- def self.name
550
- 'Node'
551
- end
546
+ def self.name; 'Node'; end
547
+ def self.to_s; 'Node'; end
552
548
  end
553
549
  end
554
550
 
@@ -572,9 +568,8 @@ describe Sequel::Model, "association_reflection" do
572
568
  before(:each) do
573
569
  MODEL_DB.reset
574
570
  @c1 = Class.new(Sequel::Model(:nodes)) do
575
- def self.name
576
- 'Node'
577
- end
571
+ def self.name; 'Node'; end
572
+ def self.to_s; 'Node'; end
578
573
  end
579
574
  end
580
575
 
@@ -600,9 +595,8 @@ describe Sequel::Model, "associations" do
600
595
  before(:each) do
601
596
  MODEL_DB.reset
602
597
  @c1 = Class.new(Sequel::Model(:nodes)) do
603
- def self.name
604
- 'Node'
605
- end
598
+ def self.name; 'Node'; end
599
+ def self.to_s; 'Node'; end
606
600
  end
607
601
  end
608
602
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_model
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.5"
4
+ version: 0.5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-08 00:00:00 +02:00
12
+ date: 2008-03-09 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency