persistize 0.0.3 → 0.0.4
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/VERSION +1 -1
- data/lib/persistize.rb +1 -1
- data/test/models/thing.rb +3 -0
- data/test/models/wadus/thing.rb +8 -0
- data/test/persistize_test.rb +10 -0
- data/test/test_helper.rb +7 -0
- metadata +6 -2
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.0. | 
| 1 | 
            +
            0.0.4
         | 
    
        data/lib/persistize.rb
    CHANGED
    
    | @@ -47,7 +47,7 @@ module Persistize | |
| 47 47 | 
             
                private
         | 
| 48 48 |  | 
| 49 49 | 
             
                def generate_callback(association, update_method)
         | 
| 50 | 
            -
                  callback_name = :"#{update_method}_in_#{self.to_s.underscore}_callback"
         | 
| 50 | 
            +
                  callback_name = :"#{update_method}_in_#{self.to_s.underscore.gsub(/\W/, '_')}_callback"
         | 
| 51 51 | 
             
                  association_type = "#{association.macro}#{'_through' if association.through_reflection}"
         | 
| 52 52 | 
             
                  generate_method = :"generate_#{association_type}_callback"
         | 
| 53 53 | 
             
                  unless respond_to?(generate_method, true)
         | 
    
        data/test/persistize_test.rb
    CHANGED
    
    | @@ -109,6 +109,16 @@ class PersistizeTest < Test::Unit::TestCase | |
| 109 109 | 
             
                    assert_equal("Enjuto Mojamuto has 3 tasks in 2 projects", @person.reload[:info])
         | 
| 110 110 | 
             
                  end
         | 
| 111 111 | 
             
                end
         | 
| 112 | 
            +
                
         | 
| 113 | 
            +
                context "namespaced models" do
         | 
| 114 | 
            +
                  
         | 
| 115 | 
            +
                  should "access to namespaced models" do
         | 
| 116 | 
            +
                    @thing = Wadus::Thing.create
         | 
| 117 | 
            +
                    2.times { |i| @thing.things.create(:name => "Thing number #{i + 1}") }
         | 
| 118 | 
            +
                    assert_equal("Thing number 1, Thing number 2", @thing.reload[:summary])
         | 
| 119 | 
            +
                  end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                end
         | 
| 112 122 |  | 
| 113 123 | 
             
              end
         | 
| 114 124 |  | 
    
        data/test/test_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: persistize
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Sergio Gil
         | 
| @@ -10,7 +10,7 @@ autorequire: | |
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 12 |  | 
| 13 | 
            -
            date: 2009- | 
| 13 | 
            +
            date: 2009-12-29 00:00:00 +01:00
         | 
| 14 14 | 
             
            default_executable: 
         | 
| 15 15 | 
             
            dependencies: []
         | 
| 16 16 |  | 
| @@ -35,6 +35,8 @@ files: | |
| 35 35 | 
             
            - test/models/person.rb
         | 
| 36 36 | 
             
            - test/models/project.rb
         | 
| 37 37 | 
             
            - test/models/task.rb
         | 
| 38 | 
            +
            - test/models/thing.rb
         | 
| 39 | 
            +
            - test/models/wadus/thing.rb
         | 
| 38 40 | 
             
            - test/persistize_test.rb
         | 
| 39 41 | 
             
            - test/test_helper.rb
         | 
| 40 42 | 
             
            has_rdoc: true
         | 
| @@ -70,5 +72,7 @@ test_files: | |
| 70 72 | 
             
            - test/models/person.rb
         | 
| 71 73 | 
             
            - test/models/project.rb
         | 
| 72 74 | 
             
            - test/models/task.rb
         | 
| 75 | 
            +
            - test/models/thing.rb
         | 
| 76 | 
            +
            - test/models/wadus/thing.rb
         | 
| 73 77 | 
             
            - test/persistize_test.rb
         | 
| 74 78 | 
             
            - test/test_helper.rb
         |