file-column plugin file size validation?

I'm having an issue with the validation. I have ...

validates_filesize_of :avatar, :in => 0.kilobytes..40.kilobytes
validates_file_format_of :avatar, :in => ["gif", "png", "jpg"]

It's catching everything fine but the problem is when the form refreshes
it displays the most recent uploaded picture (in this case) from the tmp
folder. So if I uploaded an image that was too big it will display that
one.

Any thoughts?

Jon Minori wrote:

I'm having an issue with the validation. I have ...

validates_filesize_of :avatar, :in => 0.kilobytes..40.kilobytes
validates_file_format_of :avatar, :in => ["gif", "png", "jpg"]

It's catching everything fine but the problem is when the form refreshes it displays the most recent uploaded picture (in this case) from the tmp folder. So if I uploaded an image that was too big it will display that one.

Any thoughts?

You can try something like

<% if model.errors.on(:avatar) %>
Invalid avatar
<% else %>
<%= image_tag url_for_image_column('model', 'avatar') %>
<% end %>

Yeah that seems like a pretty simple solution. Thank you!