Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

basic en translation is not loaded in v1.0 or v1.1 #2168

Closed
BookOfGreg opened this issue May 1, 2017 · 0 comments
Closed

basic en translation is not loaded in v1.0 or v1.1 #2168

BookOfGreg opened this issue May 1, 2017 · 0 comments

Comments

@BookOfGreg
Copy link

BookOfGreg commented May 1, 2017

Hi Team,

It seems that in v1 and v1.1, there are no error messages for carrierwave without them being explicitly loaded.

I would have expected the file locale/en.yml to have been loaded with orm/activerecord.rb or validations/active_model.rb by default.

Seems like it was removed in: #1848

To Reproduce:

#Bash
rails new foo
cd foo
echo "gem 'carrierwave', '~> 1.0'" >> Gemfile
bundle
echo "require 'carrierwave/orm/activerecord'" > config/initializers/carrierwave.rb
rails generate uploader Avatar
rails generate scaffold user name
rails generate migration add_avatar_to_users avatar:string
cat <<EOT >> app/models/user.rb
class User < ApplicationRecord
  mount_uploader :avatar, AvatarUploader
end
EOT
cat <<EOT >> app/uploaders/avatar_uploader.rb
class AvatarUploader < CarrierWave::Uploader::Base
  storage :file

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  def extension_whitelist
    %w(jpg jpeg gif png)
  end
end
EOT
rake db:migrate
rails console
#Rails console
u = User.new(avatar: File.open(Rails.root.join('public','favicon.ico')))
#=> #<User id: nil, name: nil, created_at: nil, updated_at: nil, avatar: nil>
u.valid?
#=> false
u.errors
#=> #<ActiveModel::Errors:0x007fa940c456a8 @base=#<User id: nil, name: nil, created_at: nil, updated_at: nil, avatar: nil>, @messages={:avatar=>["translation missing: en.errors.messages.extension_whitelist_error"]}, @details={:avatar=>[{:error=>"translation missing: en.errors.messages.extension_whitelist_error"}]}>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant