title: Running only paperclip validations in Rails
body: <p>I've model Profile</p>
  
  <pre><code>class Profile &lt; Abstract
      has_attached_file :avatar,                   
      ...
      validates_attachment_size :avatar, :less_than =&gt; 2.megabytes
      validates_attachment_content_type :avatar, :content_type =&gt; ['image/jpeg', 'image/png', ...]
      # Many other validations
  end
  </code></pre>
  
  <p>I have two different forms: one for avatar and another for all other fields. User have to be able to save avatar without filling second form. Is it possible to validate only paperclip attachment, skipping all other validations? Following <a href="https://stackoverflow.com/a/457313/1044646">this</a> answer I tried to do like this:</p>
  
  <pre><code>class Abstract &lt; ActiveRecord::Base  
      def self.valid_attribute?(attr, value)
          mock = self.new(attr =&gt; value)
          unless mock.valid?
             return !mock.errors.has_key?(attr)
          end
          true
      end
  end
  </code></pre>
  
  <p>and in controller</p>
  
  <pre><code>def update_avatar
      if params[:profile] &amp;&amp; params[:profile][:avatar].present? &amp;&amp; Profile.valid_attribute?(:avatar, params[:profile][:avatar])
          @profile.avatar = params[:profile][:avatar]
          @profile.save(:validate =&gt; false)
          ...
      else
          flash.now[:error] = t :image_save_failure_message
          render 'edit_avatar'
      end
  end
  </code></pre>
  
  <p>But it didn't work for paperclip. <code>Profile.valid_attribute?(:avatar, params[:profile][:avatar])</code> always returns true.</p>