Paperclip validation errors not flashing

I'm deliberately uploading a non-image file by POSTing to an iframe (fake Ajax) but I don't get the flash error.

My update action:

def update
    @mockup = Mockup.find_by_hash_id(params[:hash_id])
    flash[:notice] = 'Mockup updated'
      redirect_to new_or_show_mockup_path(@mockup.hash_id)
rescue Exception => e
    flash[:error] = e.message
    redirect_to new_or_show_mockup_path(@mockup.hash_id)

My model:

class Mockup < ActiveRecord::Base
    validates_attachment_content_type :image, :content_type => ['image/jpeg', 'image/jpg', 'image/png'], :message => 'Please upload an image'


I forgot to add ! to update_attributes. It should be:


Otherwise it wouldn't throw an exception.

Need Your Help

How to pass an array in an argument

java arrays

I'm curious if there's any way to hard code a drawPolygon in Java. Usually you are supposed to do something like this

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.