scaffold_plus 1.7.9 → 1.7.10
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.
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f182f94e04c6614db4fc9ca1e8979b9b0c48cfe0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b8c2007e6096bd720b17c3ff12a8806e566d8beb
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4a3ef8c01c65d272d066e51362b45f4fd736228e12054e2bcd488c3076aadcf4b1fecd87a33c957ec2df8ebe19d76eb9ba23c5f308e91008e765e66d2c4aaf1a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bd970931b042cf2d1660f5b40621a7174f5c63e6ae040f0c284c4827c7bd4e652023f972e54385d468412df1a1155a1095b62007a7db635581d77690d84969fd
         
     | 
| 
         @@ -55,9 +55,9 @@ module ScaffoldPlus 
     | 
|
| 
       55 
55 
     | 
    
         
             
                      text = before_array.include?(name) ? "\n" : ""
         
     | 
| 
       56 
56 
     | 
    
         
             
                      text << "  has_many :#{children}"
         
     | 
| 
       57 
57 
     | 
    
         
             
                      text << ", inverse_of: :#{name}" if options.inverse?
         
     | 
| 
       58 
     | 
    
         
            -
                      text << ", dependent: :#{dependent}" if options 
     | 
| 
      
 58 
     | 
    
         
            +
                      text << ", dependent: :#{dependent}" if options.dependent.present?
         
     | 
| 
       59 
59 
     | 
    
         
             
                      text << "\n"
         
     | 
| 
       60 
     | 
    
         
            -
                      if options 
     | 
| 
      
 60 
     | 
    
         
            +
                      if options.nested.present?
         
     | 
| 
       61 
61 
     | 
    
         
             
                        text << "  accepts_nested_attributes_for :#{children}\n"
         
     | 
| 
       62 
62 
     | 
    
         
             
                      end
         
     | 
| 
       63 
63 
     | 
    
         
             
                      text << "\n" if after_array.include?(name)
         
     | 
| 
         @@ -68,8 +68,8 @@ module ScaffoldPlus 
     | 
|
| 
       68 
68 
     | 
    
         
             
                    inject_into_class "app/models/#{child}.rb", child.camelize do
         
     | 
| 
       69 
69 
     | 
    
         
             
                      text = before_array.include?(child) ? "\n" : ""
         
     | 
| 
       70 
70 
     | 
    
         
             
                      text << "  belongs_to :#{name}"
         
     | 
| 
       71 
     | 
    
         
            -
                      if options 
     | 
| 
       72 
     | 
    
         
            -
                        text << ", foreign_key: \"#{options 
     | 
| 
      
 71 
     | 
    
         
            +
                      if options.foreign_key.present?
         
     | 
| 
      
 72 
     | 
    
         
            +
                        text << ", foreign_key: \"#{options.foreign_key}\""
         
     | 
| 
       73 
73 
     | 
    
         
             
                      end
         
     | 
| 
       74 
74 
     | 
    
         
             
                      text << ", inverse_of: :#{children}" if options.inverse?
         
     | 
| 
       75 
75 
     | 
    
         
             
                      text << ", counter_cache: true" if options.counter?
         
     | 
| 
         @@ -80,8 +80,8 @@ module ScaffoldPlus 
     | 
|
| 
       80 
80 
     | 
    
         
             
                  end
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
82 
     | 
    
         
             
                  def add_to_permit
         
     | 
| 
       83 
     | 
    
         
            -
                    return  
     | 
| 
       84 
     | 
    
         
            -
                    list = options 
     | 
| 
      
 83 
     | 
    
         
            +
                    return if options.nested.blank?
         
     | 
| 
      
 84 
     | 
    
         
            +
                    list = options.nested.map{|n| ":#{n}"}.join(', ')
         
     | 
| 
       85 
85 
     | 
    
         
             
                    text = "#{children}_attributes: [ #{list} ]"
         
     | 
| 
       86 
86 
     | 
    
         
             
                    file = "app/controllers/#{table_name}_controller.rb"
         
     | 
| 
       87 
87 
     | 
    
         
             
                    gsub_file file, /(permit\(.*)\)/, "\\1, #{text})"
         
     | 
| 
         @@ -117,10 +117,10 @@ module ScaffoldPlus 
     | 
|
| 
       117 
117 
     | 
    
         
             
                  end
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
       119 
119 
     | 
    
         
             
                  def dependent
         
     | 
| 
       120 
     | 
    
         
            -
                    if options 
     | 
| 
      
 120 
     | 
    
         
            +
                    if options.dependent.present? and options.dependent == "restrict"
         
     | 
| 
       121 
121 
     | 
    
         
             
                      "restrict_with_exception"
         
     | 
| 
       122 
122 
     | 
    
         
             
                    else
         
     | 
| 
       123 
     | 
    
         
            -
                      options 
     | 
| 
      
 123 
     | 
    
         
            +
                      options.dependent
         
     | 
| 
       124 
124 
     | 
    
         
             
                    end
         
     | 
| 
       125 
125 
     | 
    
         
             
                  end
         
     | 
| 
       126 
126 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: scaffold_plus
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.7. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.7.10
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Volker Wiegand
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014-10- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-10-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activerecord
         
     |