2

I dropped my old development db to get a fresh one on my rails 3.1.3 application. But, when i run bundle exec rake db:seed --trace I get the following error:

rafael@WALL-A:~/workspace/media-choice$ bundle exec rake db:seed --trace
** Invoke db:seed (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Invoke disable_rails_admin_initializer (first_time)
** Execute disable_rails_admin_initializer
** Execute environment
[DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.models.delayed_upload_error" is no longer supported
** Execute db:abort_if_pending_migrations
** Execute db:seed
rake aborted!
stack level too deep
/home/rafael/.rvm/gems/ruby-1.9.3-p0@media-choice/gems/rake-0.9.2.2/lib/rake/task.rb:162
Tasks: TOP => db:seed
rafael@WALL-A:~/workspace/media-choice$

I've read here that it could a sass-3.1.5 problem and a downgrade to 3.1.4 would fix it. But, for me it didn't work. Also I read here it could be a rvm gemset issue. So I've uninstalled my rvm and reinstalled and all my rubies and gems. But the problem still here.

I also thought it could be my mistake on the seeds file, but I don't see no problem here:

# -*- encoding : utf-8 -*-

occupation = Occupation.create!(name: 'Estudante')

sponsor = Sponsor.create!(name: 'PROAC', logo: File.open('db/seeds/proac.jpg'))

contest = Contest.create!(name: 'Tema Livre', description: 'descrição', start_date: Date.today - 1.month, end_date: Date.today + 1.month,
                          call_text: 'call text', logo: File.open('db/seeds/freesubject.jpg'), enabled: true, show_in_upload: true )
contest.sponsors << sponsor
contest.content_types.create!(name: 'video')
contest.content_types.create!(name: 'audio')
contest.content_types.create!(name: 'wording')
contest.content_types.create!(name: 'photo')

user = User.new(first_name: 'José', last_name: 'da Silva', email: 'email@email.com', password: 'senhasenha',
                    country: 'Brasil', state: 'SP', city: 'São Paulo', gender: 'Masculino', birthdate: Date.today - 30.years,
                    commercialize_videos: true)
user.occupation = occupation
user.confirm!
user.save!

user2 = User.new(first_name: 'José', last_name: 'da Silva', email: 'email2@email.com', password: 'senhasenha',
                    country: 'Brasil', state: 'SP', city: 'São Paulo', gender: 'Masculino', birthdate: Date.today - 30.years,
                    commercialize_videos: true)
user2.occupation = occupation
user2.confirm!
user2.save!


user3 = User.new(first_name: 'José', last_name: 'da Silva', email: 'email3@email.com', password: 'senhasenha',
                    country: 'Brasil', state: 'SP', city: 'São Paulo', gender: 'Masculino', birthdate: Date.today - 30.years,
                    commercialize_videos: true)
user3.occupation = occupation
user3.confirm!
user3.save!

Anyone have any tip?

Thank you!

Community
  • 1
  • 1
manzo
  • 51
  • 3

2 Answers2

2

Hopefully this will help someone.

On mine it was due to an after_save method that i had added that was being called over and over again. I changed that to after_create and all is well.

Austio
  • 5,939
  • 20
  • 34
1

I know this is an old post, but having just dealt with the same error for a very long time, I think I can help you or future viewers.

For me, the problem was non escaped characters. Specifically, I had single quotes in some entries (of approximately 100,000) I was seeding. Once I replaced these with \' I no longer had the problem.

I see in your pasted code accented "e"s. I know these can be problematic if the incorrect encoding is being used.