throughcheckboxes 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.
| @@ -12,25 +12,21 @@ module ThroughCheckboxes | |
| 12 12 |  | 
| 13 13 | 
             
                            ThroughCheckboxes::Core.validate(klass, *relations)
         | 
| 14 14 |  | 
| 15 | 
            -
                             | 
| 15 | 
            +
                            relations.each { |relation|
         | 
| 16 16 |  | 
| 17 | 
            -
                                field_name= | 
| 17 | 
            +
                                field_name=ThroughCheckboxes::Core.field_name(relation)
         | 
| 18 18 |  | 
| 19 | 
            -
                                 | 
| 20 | 
            -
                                    attr_accessible field_name.to_sym
         | 
| 21 | 
            -
                                end
         | 
| 19 | 
            +
                                attr_accessible field_name.to_sym
         | 
| 22 20 |  | 
| 23 | 
            -
                                 | 
| 24 | 
            -
                                     | 
| 25 | 
            -
             | 
| 26 | 
            -
                                    end
         | 
| 21 | 
            +
                                define_method "#{field_name}=" do |ids|
         | 
| 22 | 
            +
                                    send("#{relation}=",ids.select { |id| id.present? }.map {|id| ThroughCheckboxes::Core.relation_klass(klass, relation).find(id)})
         | 
| 23 | 
            +
                                end
         | 
| 27 24 |  | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                                    end
         | 
| 25 | 
            +
                                define_method field_name do
         | 
| 26 | 
            +
                                    send("#{relation}").map {|e| e.id}
         | 
| 31 27 | 
             
                                end
         | 
| 32 28 |  | 
| 33 | 
            -
                             | 
| 29 | 
            +
                            }
         | 
| 34 30 |  | 
| 35 31 | 
             
                        end
         | 
| 36 32 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,12 +1,8 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: throughcheckboxes
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              prerelease:  | 
| 5 | 
            -
               | 
| 6 | 
            -
              - 0
         | 
| 7 | 
            -
              - 0
         | 
| 8 | 
            -
              - 3
         | 
| 9 | 
            -
              version: 0.0.3
         | 
| 4 | 
            +
              prerelease: 
         | 
| 5 | 
            +
              version: 0.0.4
         | 
| 10 6 | 
             
            platform: ruby
         | 
| 11 7 | 
             
            authors: 
         | 
| 12 8 | 
             
            - lucapette
         | 
| @@ -14,7 +10,7 @@ autorequire: | |
| 14 10 | 
             
            bindir: bin
         | 
| 15 11 | 
             
            cert_chain: []
         | 
| 16 12 |  | 
| 17 | 
            -
            date: 2011-03- | 
| 13 | 
            +
            date: 2011-03-13 00:00:00 +01:00
         | 
| 18 14 | 
             
            default_executable: 
         | 
| 19 15 | 
             
            dependencies: []
         | 
| 20 16 |  | 
| @@ -52,21 +48,17 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 52 48 | 
             
              requirements: 
         | 
| 53 49 | 
             
              - - ">="
         | 
| 54 50 | 
             
                - !ruby/object:Gem::Version 
         | 
| 55 | 
            -
                  segments: 
         | 
| 56 | 
            -
                  - 0
         | 
| 57 51 | 
             
                  version: "0"
         | 
| 58 52 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 59 53 | 
             
              none: false
         | 
| 60 54 | 
             
              requirements: 
         | 
| 61 55 | 
             
              - - ">="
         | 
| 62 56 | 
             
                - !ruby/object:Gem::Version 
         | 
| 63 | 
            -
                  segments: 
         | 
| 64 | 
            -
                  - 0
         | 
| 65 57 | 
             
                  version: "0"
         | 
| 66 58 | 
             
            requirements: []
         | 
| 67 59 |  | 
| 68 60 | 
             
            rubyforge_project: throughcheckboxes
         | 
| 69 | 
            -
            rubygems_version: 1. | 
| 61 | 
            +
            rubygems_version: 1.5.2
         | 
| 70 62 | 
             
            signing_key: 
         | 
| 71 63 | 
             
            specification_version: 3
         | 
| 72 64 | 
             
            summary: This gem will handle has_many :through association with checkboxes
         |