GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
fixed more bugginess in the Default inheritance setup of Sequel ORM
automatthew (author)
Wed Jun 18 15:17:03 -0700 2008
commit  c7b05f025099ea051754bb6ea4e9da22ff50c0b0
tree    f552f8869a55992cb7e1794e31b67b11eec663d5
parent  ca31977914c895e4afa42ee36f50dd621f23206a
...
16
17
18
19
20
21
 
 
22
23
 
 
 
24
25
26
...
16
17
18
 
 
 
19
20
21
22
23
24
25
26
27
28
0
@@ -16,11 +16,13 @@ module Waves
0
 
0
         app.instance_eval do
0
 
0
- auto_create_module( :Models ) { include AutoCode }
0
-
0
- auto_eval( :Models ) do
0
+ auto_create_module( :Models ) do
0
+ include AutoCode
0
             auto_create_class :Default
0
             auto_load :Default, :directories => [:models]
0
+ end
0
+
0
+ auto_eval( :Models ) do
0
             auto_create_class true, app::Models::Default
0
             auto_load true, :directories => [ :models ]
0
           end
...
28
29
30
31
 
32
33
34
 
 
 
35
36
 
 
 
37
38
39
...
28
29
30
 
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
0
@@ -28,12 +28,18 @@ module Waves
0
           
0
           app.instance_eval do
0
             
0
- auto_eval :Models do
0
+ auto_create_module( :Models ) do
0
               include AutoCode
0
               auto_create_class :Default, ::Sequel::Model
0
               auto_load :Default, :directories => [ :models ]
0
+ end
0
+
0
+ auto_eval :Models do
0
               auto_create_class true, app::Models::Default
0
               auto_load true, :directories => [ :models ]
0
+ # set the Sequel dataset based on the model class name
0
+ # note that this is not done for app::Models::Default, as it isn't
0
+ # supposed to represent a table
0
               auto_eval true do
0
                 default = superclass.basename.snake_case.pluralize.intern
0
                 if @dataset && @dataset.opts[:from] != [ default ]
...
23
24
25
 
26
27
28
29
 
30
31
32
...
23
24
25
26
27
28
29
 
30
31
32
33
0
@@ -23,10 +23,11 @@ describe "An application module which includes the Sequel ORM layer" do
0
     
0
   it "auto_creates models that inherit from Sequel::Model" do
0
     TA::Models::Default.superclass.should == Sequel::Model
0
+ TA::Models::Thingy.superclass.should == TA::Models::Default
0
   end
0
   
0
   it "sets the dataset to use the snake_case of the class name as the table name" do
0
- TA::Models::Default.dataset.send(:to_table_reference).should =~ /SELECT.+FROM.+defaults+/
0
+ TA::Models::Thingy.dataset.send(:to_table_reference).should =~ /SELECT.+FROM.+thingies+/
0
   end
0
   
0
   it "provides an accessor for database" do

Comments

    No one has commented yet.