title: Ruby On Rails Active Storage purge/delete method throws NoMethodError
body: <p>I have a problem with my image purge/delete for images after they have been uploaded via Active Storage. I have tried to follow the instructions and I still get the same error. The error is described in command line as Template Error ::Error (undefined method 'stringify_keys' for ....</p>
  
  <p>Any suggestion would be great</p>
  
  <p><a href="https://i.stack.imgur.com/inwD2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/inwD2.png" alt="enter image description here"></a></p>
  
  <p><strong>Command Line</strong></p>
  
  <pre><code>ActionView::Template::Error (undefined method `stringify_keys' for "http://localhost:3000/jobs/21/delete_image_attachment":String):
      11:         &lt;div class="panel-body"&gt;
      12:           &lt;span class="pull-right"&gt;
      13:             &lt;%=
      14:             link_to 'Remove', delete_image_attachment_job_url(@job.images[image]),
      15:             remote: true,
      16:             method: :delete,
      17:             data: {confirm: "Are you sure"} do %&gt;
  
  app/views/jobs/_photos_list.html.erb:14:in `block in _app_views_jobs__photos_list_html_erb__192211306_83310024'
  app/views/jobs/_photos_list.html.erb:5:in `_app_views_jobs__photos_list_html_erb__192211306_83310024'
  app/views/jobs/photo_upload.html.erb:51:in `_app_views_jobs_photo_upload_html_erb___795227943_83576688'
  </code></pre>
  
  <p><strong>My Model</strong></p>
  
  <pre><code>class Job &lt; ApplicationRecord
    belongs_to :user
    has_many_attached :images
  
    validates :job_category, presence: true
    validates :job_type, presence: true
    validates :recurrence, presence: true
    #validates :job_title, presence: true
    #validates :job_description, presence: true
  
  end
  </code></pre>
  
  <p><strong>The Controller</strong></p>
  
  <pre><code>class JobsController &lt; ApplicationController
  
    before_action :set_job , except: [:index, :new, :create, :edit]
    before_action :authenticate_user!, except: [:show]
    before_action :is_authorised, only: [:listing, :budget, :description, :photo_upload, :location, :update, :show, :delete ]
  
    def delete_image_attachment
      @images = ActiveStorage::Attachment.find(params[:id])
      @images.purge
      redirect_back(fallback_location: request.referer)
    end
  </code></pre>
  
  <p><strong>The View</strong></p>
  
  <pre><code>&lt;% if @job.images.attached? %&gt;
    &lt;br/&gt;
  
    &lt;div class="row"&gt;
      &lt;% (0...@job.images.count).each do |image| %&gt;
      &lt;div class="col-md-4"&gt;
        &lt;div class="panel panel-default"&gt;
          &lt;div class="panel-heading preview"&gt;
            &lt;%= image_tag(@job.images[image]) %&gt;
          &lt;/div&gt;
          &lt;div class="panel-body"&gt;
            &lt;span class="pull-right"&gt;
              &lt;%=
              link_to 'Remove', delete_image_attachment_job_url(@job.images[image]),
              remote: true,
              method: :delete,
              data: {confirm: "Are you sure"} do %&gt;
                &lt;i class="fa fa-trash-o" aria-hidden="true"&gt;&lt;/i&gt;
              &lt;% end %&gt;
            &lt;/span&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;% end %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong>My Routes</strong></p>
  
  <pre><code>Rails.application.routes.draw do
  
    root 'pages#home'
  
    resources :jobs_devs
    resources :jobs
  
    resources :jobs_devs, except: [:placeholder] do
      member do
        get 'listing'
        get 'budget'
        get 'description'
        get 'photo_upload'
        get 'featured'
        get 'location'
        get 'update'
        get 'premium'
        get 'show'
        delete :delete_image_attachment
      end
    end
  
    devise_for    :users,
              :path =&gt; '',
              :path_names =&gt; {:sign_in =&gt; 'login', :sign_out =&gt; 'logout', :edit =&gt; 'profile', :sign_up =&gt; 'registration'},
              :controllers =&gt; {:omniauth_callbacks =&gt; 'omniauth_callbacks', :registrations =&gt; 'registrations' }
  
    resources :users, only: [:show]
    resources :jobs, except: [:edit] do
      member do
        get 'listing'
        get 'budget'
        get 'description'
        get 'photo_upload'
        get 'featured'
        get 'location'
        get 'update'
        get 'premium'
        get 'show'
        delete :delete_image_attachment
      end
    end
  end
  </code></pre>