0
votes

carrierwave is giving me this validation error:

Image You are not allowed to upload "pages" files, allowed types: jpg, jpeg, gif, png

any idea how to remove the "image" attribute bit from the beginning? it doesn't read very well.

1
I guess you tried that github.com/jnicklas/carrierwave#i18n ? - pjam
This is not a carrierwave problem, it's a rails problem, and a pretty old one: ruby-forum.com/topic/196109 and stackoverflow.com/questions/808547/… - Chris Salzberg
@shioyama - That sounds like the solution, but how to do it for carrierwave? - pingu

1 Answers

2
votes

I believe this should work:

class MyModel < ActiveRecord::Base

  ...

  HUMANIZED_COLUMNS = {:image => ""}

  def self.human_attribute_name(attribute)
    HUMANIZED_COLUMNS[attribute.to_sym] || super
  end

 ...

end

Documentation on human_attribute_name

Alternatively, in your locales file, add:

en:
  activerecord:
    attributes:
      my_model:
        image: ""

In both cases, replace MyModel/my_model by the name of the activerecord class that you are uploading images to.