mage 0.2.1 → 0.2.2
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 +4 -4
- data/README.md +9 -0
- data/lib/mage/action_controller_patch.rb +2 -4
- data/lib/mage/active_record_patch.rb +3 -1
- data/lib/mage/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 5b630df5048a60f851ecfb1044ae31f9accdde62
         | 
| 4 | 
            +
              data.tar.gz: 9b723b089bb49fb95a330ed663e8b5e59acdc5b3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 32d5736f10a84ef8880ff0229e0b2c7aa7825995179124ec6b1ec9c137d43d167b2103d93a8d9d6661e7479954db78f64b7b80fbb35bd4ba293e4bba92135ae7
         | 
| 7 | 
            +
              data.tar.gz: daa9c573864ac9f12e329164f6839f7e1a0b70e1fe7c4db542550a03f46f69f177fc3fee0bee83a021e9e7eabdb79f42d0732159f906ec7773fbc53648f3105a
         | 
    
        data/README.md
    CHANGED
    
    | @@ -99,6 +99,14 @@ render_mage method like this: | |
| 99 99 | 
             
            render_mage(@product, show_step: true)
         | 
| 100 100 | 
             
            ```
         | 
| 101 101 |  | 
| 102 | 
            +
            To query only finished objects use 'mage_done' scope:
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            ```ruby
         | 
| 105 | 
            +
            def index
         | 
| 106 | 
            +
                @products = product.mage_done
         | 
| 107 | 
            +
            end
         | 
| 108 | 
            +
            ```
         | 
| 109 | 
            +
             | 
| 102 110 | 
             
            ## Contributing
         | 
| 103 111 |  | 
| 104 112 | 
             
            Bug reports and pull requests are welcome on GitHub at https://github.com/effect305/mage.
         | 
| @@ -108,6 +116,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/effect | |
| 108 116 | 
             
            I think there's a lot of stuff to do. Here's just examples:
         | 
| 109 117 | 
             
            * ~~Keep flash messages if showing step~~
         | 
| 110 118 | 
             
            * ~~Generator~~
         | 
| 119 | 
            +
            * Back button
         | 
| 111 120 | 
             
            * Tests
         | 
| 112 121 |  | 
| 113 122 | 
             
            ## License
         | 
| @@ -13,10 +13,8 @@ class ActionController::Base | |
| 13 13 | 
             
                    if options[:show_step] && params[:step].blank?
         | 
| 14 14 | 
             
                      mage_redirect(object, options[:show_step])
         | 
| 15 15 | 
             
                    else
         | 
| 16 | 
            -
                       | 
| 17 | 
            -
                         | 
| 18 | 
            -
                          errors.each { |error| object.errors[attribute] << error }
         | 
| 19 | 
            -
                        end
         | 
| 16 | 
            +
                      (flash["#{object.model_name.name.downcase}_errors"] || {}).each do |attribute, errors|
         | 
| 17 | 
            +
                        errors.each { |error| object.errors[attribute] << error }
         | 
| 20 18 | 
             
                      end
         | 
| 21 19 | 
             
                      render "#{params[:controller]}/steps/#{object.mage_step}"
         | 
| 22 20 | 
             
                    end
         | 
| @@ -1,10 +1,12 @@ | |
| 1 1 | 
             
            class ActiveRecord::Base
         | 
| 2 2 | 
             
              def self.has_mage_steps(*steps)
         | 
| 3 3 | 
             
                @@mage_steps = steps
         | 
| 4 | 
            +
                has_one :mage_step, class_name: 'Mage::MageStep', as: :object
         | 
| 5 | 
            +
                scope :mage_done, -> { joins(:mage_step).where(mage_steps: { step: :done }) }
         | 
| 4 6 | 
             
                after_save :mage_after_save
         | 
| 5 7 | 
             
                after_destroy { Mage::MageStep.where(object_id: self.id, object_type: self.model_name.name).try(:take).try(:destroy) }
         | 
| 6 8 |  | 
| 7 | 
            -
                 | 
| 9 | 
            +
                def self.mage_steps
         | 
| 8 10 | 
             
                  @@mage_steps
         | 
| 9 11 | 
             
                end
         | 
| 10 12 |  | 
    
        data/lib/mage/version.rb
    CHANGED