# Rake aborted! Validation failed:

**URL:** <https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371>\
**Category:** Ruby\
**Created:** [October 12, 2010, 10:42am UTC](https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371 "2010-10-12T10:42:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![masterly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@masterly](https://www.ruby-forum.com/u/masterly)\
**Post date:** [October 12, 2010, 10:42am UTC](https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371/1 "2010-10-12T10:42:25Z")

</div>

Trying to populate a database with some users using rake db:populate.

But im getting this error trace:

\*\* Invoke db:populate (first\_time)  
\*\* Invoke db:populate:accounts (first\_time)  
\*\* Invoke db:populate:setup (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:populate:setup  
\*\* Execute db:populate:accounts  
[populate] accounts  
rake aborted!  
Validation failed: Logo failed to be processed.  
/home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active\_record/validations.rb:1090:in  
`save_without_dirty!' /home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/dirty.rb:87:in `save\_without\_transactions!’  
/home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active\_record/transactions.rb:200:in  
`save!' /home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction’  
/home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active\_record/transactions.rb:182:in  
`transaction' /home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:200:in `save!’  
/home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active\_record/transactions.rb:208:in  
`rollback_active_record_state!' /home/andersnguyen/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:200:in `save!’  
/usr/lib/ruby/gems/1.8/gems/machinist-1.0.6/lib/machinist/active\_record.rb:55:in  
`make' /home/andersnguyen/rubyprojects/mediapilot/lib/tasks/populate.rake:35 /usr/lib/ruby/1.8/rake.rb:636:in `call’  
/usr/lib/ruby/1.8/rake.rb:636:in `execute' /usr/lib/ruby/1.8/rake.rb:631:in `each’  
/usr/lib/ruby/1.8/rake.rb:631:in `execute' /usr/lib/ruby/1.8/rake.rb:597:in `invoke\_with\_call\_chain’  
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/1.8/rake.rb:590:in `invoke\_with\_call\_chain’  
/usr/lib/ruby/1.8/rake.rb:607:in `invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:604:in `each’  
/usr/lib/ruby/1.8/rake.rb:604:in `invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:596:in `invoke\_with\_call\_chain’  
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/1.8/rake.rb:590:in `invoke\_with\_call\_chain’  
/usr/lib/ruby/1.8/rake.rb:583:in `invoke' /usr/lib/ruby/1.8/rake.rb:2051:in `invoke\_task’  
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level' /usr/lib/ruby/1.8/rake.rb:2029:in `each’  
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level' /usr/lib/ruby/1.8/rake.rb:2068:in `standard\_exception\_handling’  
/usr/lib/ruby/1.8/rake.rb:2023:in `top_level' /usr/lib/ruby/1.8/rake.rb:2001:in `run’  
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1998:in `run’  
/usr/bin/rake:28

here is the populate.db file:

# encoding: utf-8

class Range  
def random  
rand(last - first + 1) + first  
end  
end

namespace :db do

desc “Erase and fill database”  
task :populate =\> [  
‘db:populate:accounts’,  
‘db:populate:users’,  
‘db:populate:memberships’,  
‘db:populate:feeds’,  
‘db:populate:events’,  
‘db:populate:sources’,  
‘db:populate:editorials’,  
‘db:populate:social\_posts’,  
‘db:populate:variables’,  
‘db:populate:statistics’,  
‘feed:retrieve’  
]

namespace :populate do

```
task :setup => :environment do
  require File.join(Rails.root, 'spec', 'blueprints')
end

task :accounts => 'db:populate:setup' do
  puts "[populate] accounts"
  Account.delete_all
  Account.make(:name => 'SJ', :logo =>

```

File.open(Rails.root.join(‘features/fixtures/logo-sj.png’)))  
Account.make(:name =\> ‘Telia’, :logo =\>  
File.open(Rails.root.join(‘features/fixtures/logo-telia.png’)))  
Account.make(:name =\> ‘Stena Line’, :logo =\>  
File.open(Rails.root.join(‘features/fixtures/logo-stena.png’)))  
Account.make(:name =\> ‘Max’, :logo =\>  
File.open(Rails.root.join(‘features/fixtures/logo-max.png’)))  
Account.make(:name =\> ‘Coop’, :logo =\>  
File.open(Rails.root.join(‘features/fixtures/logo-coop.png’)))  
end

```
task :users => 'db:populate:setup' do
  puts "[populate] users"
  User.delete_all
  User.make(:password => 'test1234', :email => "removed_email_address@domain.invalid",

```

:role =\> ‘admin’, :locale =\> “en”)  
User.make(:password =\> ‘test1234’, :email =\> “removed\_email\_address@domain.invalid”,  
:role =\> ‘analyst’, :locale =\> “en”)  
User.make(:password =\> ‘test1234’, :email =\> “removed\_email\_address@domain.invalid”,  
:role =\> ‘customer’, :locale =\> “en”)  
User.make(:password =\> ‘test1234’, :email =\> “removed\_email\_address@domain.invalid”,  
:role =\> ‘admin’, :locale =\> “sv”)  
12.times { User.make(:role =\> (User::ROLES - [‘Admin’]).rand) }  
end

```
task :memberships => 'db:populate:setup' do
  puts "[populate] memberships"
  Membership.delete_all
 User.find(:all, :conditions => "role != 'Admin'").each do | user |
    if user.customer?
      user.accounts << Account.random
    else
      (1..4).random.times { user.accounts << Account.random }
    end
  end
end

task :sources => 'db:populate:setup' do
  puts "[populate] sources"
  Source.delete_all
  Source.make(:name => 'Aftonbladet', :circulation => 1_232_432,

```

:category =\> ‘popular’)  
Source.make(:name =\> ‘DN’, :circulation =\> 1\_632\_653, :category =\>  
‘large\_city’)  
Source.make(:name =\> ‘Expressen’, :circulation =\> 823\_583,  
:category =\> ‘popular’)  
Source.make(:name =\> ‘Göteborgs-Posten’, :circulation =\> 442\_556,  
:category =\> ‘large\_city’)  
Source.make(:name =\> ‘Sydsvenska Dagbladet’, :circulation =\>  
350\_834, :category =\> ‘local’)  
Source.make(:name =\> ‘Dagens Industri’, :circulation =\> 2\_342\_342,  
:category =\> ‘trade’)  
Source.make(:name =\> ‘Engadget’, :circulation =\> 7\_234\_618,  
:category =\> ‘trade’)  
Source.make(:name =\> ‘Tech Crunch’, :circulation =\> 13\_546\_245,  
:category =\> ‘trade’)  
Source.make(:name =\> ‘Wired’, :circulation =\> 1\_350\_000, :category  
=\> ‘trade’)  
end

```
task :feeds => 'db:populate:setup' do
  puts "[populate] feeds"
  Feed.delete_all

 Account.all.each do | account |
    [
      ['http://www.dn.se/m/rss/toppnyheter', "DN.se toppnyheter"],
      ['http://www.gp.se/1.16943', 'Göteborgsposten'],
      ['http://www.aftonbladet.se/sportbladet/rss.xml', 'Aftonbladet

```

sportnyheter’],  
[‘[http://www.sr.se/rssfeed/rssfeed.aspx?rssfeed=83&format=1](http://www.sr.se/rssfeed/rssfeed.aspx?rssfeed=83&format=1)’,  
‘Sveriges Radio EKOT’]  
].each do | url, name |  
account.feeds.make(:name =\> name, :url =\> url, :category =\>  
‘editorial’)  
end  
[  
[‘[http://twitter.com/statuses/user\_timeline/17023971.rss](http://twitter.com/statuses/user_timeline/17023971.rss)’,  
“eLabs on Twitter”, false],  
[‘[http://twitter.com/statuses/user\_timeline/23775395.rss](http://twitter.com/statuses/user_timeline/23775395.rss)’,  
‘MediaPilot on Twitter’, false],  
[‘[Redirecting...](http://friendfeed.com/cjkihlbom?format=atom)’, ‘CJ Kihlbom on  
FriendFeed’, true],  
[‘[http://feeds.digg.com/digg/upcoming.rss](http://feeds.digg.com/digg/upcoming.rss)’, ‘Fresh stuff on  
Digg’, true]  
].each do | url, name, preview |  
account.feeds.make(:name =\> name, :url =\> url, :category =\>  
‘social’, :preview =\> preview)  
end  
end  
end

```
task :events => 'db:populate:setup' do
  puts "[populate] events"
  Event.delete_all
 Account.all.each do | account |
    (10..15).random.times { Event.make(:account => account) }
  end
end

task :editorials => 'db:populate:setup' do
  puts "[populate] editorials"
  Editorial.delete_all
  Account.all.each do | account |
    (60..100).random.times { Editorial.make(:printed, :account =>

```

account, :event =\> account.events.random, :source =\> Source.random) }  
account.editorial\_feed\_items.each do | item |  
Editorial.make(:web, :account =\> account, :feed\_item =\> item,  
:url =\> item.url, :headline =\> item.title, :event =\>  
account.events.random, :source =\> Source.random) if(rand(2).zero?)  
end  
end  
end

```
task :social_posts => 'db:populate:setup' do
  puts "[populate] social_posts"
  SocialPost.delete_all
 Account.all.each do | account |
 account.social_feed_items.each do | item |
      SocialPost.make(:account => account, :feed_item => item,

```

:headline =\> item.title) if(rand(2).zero?)  
end  
end  
end

```
task :variables => 'db:populate:setup' do
  puts "[populate] custom variables"
  Variable.delete_all
  VariableOption.delete_all
  EditorialVariableOption.delete_all
  SocialPostVariableOption.delete_all
 Account.all.each do | account |
    products = account.variables.make(:name => 'Products',

```

:multiple\_choice =\> true, :category =\> ‘editorial’)  
%w(Fanta Sprite Cola).each do | option\_name |  
products.options.make(:name =\> option\_name)  
end  
flavors = account.variables.make(:name =\> ‘Flavors’,  
:multiple\_choice =\> false, :category =\> ‘editorial’)  
%w(Sweet Sour Bitter Salty).each do | option\_name |  
flavors.options.make(:name =\> option\_name)  
end  
sugar\_content = account.variables.make(:name =\> ‘Sugar Content’,  
:multiple\_choice =\> false, :category =\> ‘social’)  
%w(Diabetes High Medium Low).each do | option\_name |  
sugar\_content.options.make(:name =\> option\_name)  
end

```
    product_options = products.options
    flavor_options = flavors.options
   account.editorials.each do | editorial |
      editorial.variable_options.push(*product_options.shuffle[0,rand(4)])
      editorial.variable_options.push(flavor_options.rand)
    end

    sugar_content_options = sugar_content.options
   account.social_posts.each do | social_post |
      social_post.variable_options.push(sugar_content_options.rand)
    end

  end

end

task :statistics => 'db:populate:setup' do
  puts '[populate] statistics'
  Statistic.delete_all
 Account.all.each do | account |
    account.statistics.make(:pie, :category => 'editorial', :name =>

```

‘Favorability Overview’, :group\_parameter\_one\_type =\> ‘favorability’)  
account.statistics.make(:bar, :category =\> ‘editorial’, :name =\>  
‘Media types’, :group\_parameter\_one\_type =\> ‘medium’,  
:group\_parameter\_two\_type =\> nil)  
sugar\_content = account.variables.find\_by\_name(‘Sugar Content’)  
account.statistics.make(:bar, :category =\> ‘social’, :name =\>  
‘Sugar content per favorability’, :group\_parameter\_one\_type =\>  
“variable\_#{sugar\_content.id}”, :group\_parameter\_two\_type =\>  
‘favorability’)  
account.statistics.make(:line, :category =\> ‘social’, :name =\>  
‘Development of Comments’, :group\_parameter\_one\_type =\> ‘time\_months’,  
:group\_parameter\_two\_type =\> ‘comments’)  
end  
end  
end

end

---

<div class="post-metadata">

**Author:** ![masterly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@masterly](https://www.ruby-forum.com/u/masterly)\
**Post date:** [October 12, 2010, 1:59pm UTC](https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371/2 "2010-10-12T13:59:12Z")

</div>

On Oct 12, 5:42am, Anders N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Trying to populate a database with some users using rake db:populate.

This is Ruby-Talk, mainly covering Ruby specific topics, not Rails  
development questions.

You will get better results asking this in a Rails-specific forum,  
check their site for info:

> **[Community](https://rubyonrails.org/community)**
>
> A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

A hint for you to investigate: If is failing to process your  
attachment (Logo) must be there is no attachment processor installed  
(ImageMagick?).

---

<div class="post-metadata">

**Author:** ![masterly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@masterly](https://www.ruby-forum.com/u/masterly)\
**Post date:** [October 12, 2010, 4:53pm UTC](https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371/3 "2010-10-12T16:53:29Z")

</div>

Luis L. wrote in post #949462:

> On Oct 12, 5:42am, Anders N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Trying to populate a database with some users using rake db:populate.
> 
> This is Ruby-Talk, mainly covering Ruby specific topics, not Rails  
> development questions.
> 
> You will get better results asking this in a Rails-specific forum,  
> check their site for info:
> 
> [Ruby on Rails — Community](http://rubyonrails.org/community)
> 
> A hint for you to investigate: If is failing to process your  
> attachment (Logo) must be there is no attachment processor installed  
> (ImageMagick?).

Can admin move this question to the rails thread.

I have ImageMagick installed. Can i have done something wrong with the  
installation of Imagemagic?

Im currently working on Ubuntu

---

<div class="post-metadata">

**Author:** ![masterly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@masterly](https://www.ruby-forum.com/u/masterly)\
**Post date:** [October 12, 2010, 6:50pm UTC](https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371/4 "2010-10-12T18:50:02Z")

</div>

On Tue, Oct 12, 2010 at 11:32 AM, Phillip G. \<  
removed\_email\_address@domain.invalid\> wrote:

> On Tue, Oct 12, 2010 at 4:53 PM, Anders N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > I have ImageMagick installed. Can i have done something wrong with the  
> > installation of Imagemagic?
> 
> You’d need the ImageMagick gem, I guess (no idea what it is called),  
> so that Rake can make use of ImageMagick from within Ruby.

It’s called RMagick. [rmagick | RubyGems.org | your community gem host](http://rubygems.org/gems/rmagick)

---

<div class="post-metadata">

**Author:** ![masterly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@masterly](https://www.ruby-forum.com/u/masterly)\
**Post date:** [October 12, 2010, 6:33pm UTC](https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371/5 "2010-10-12T18:33:46Z")

</div>

On Tue, Oct 12, 2010 at 4:53 PM, Anders N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Can admin move this question to the rails thread.

I doubt it, since the ruby forum is a gateway to the Usenet group /  
mailing lists of the Ruby world.

> I have ImageMagick installed. Can i have done something wrong with the  
> installation of Imagemagic?

You’d need the ImageMagick gem, I guess (no idea what it is called),  
so that Rake can make use of ImageMagick from within Ruby.

–  
Phillip G.

Though the folk I have met,  
(Ah, how soon!) they forget  
When I’ve moved on to some other place,  
There may be one or two,  
When I’ve played and passed through,  
Who’ll remember my song or my face.

---

<div class="post-metadata">

**Author:** ![masterly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@masterly](https://www.ruby-forum.com/u/masterly)\
**Post date:** [October 13, 2010, 9:35am UTC](https://www.ruby-forum.com/t/rake-aborted-validation-failed/196371/6 "2010-10-13T09:35:37Z")

</div>

Ive installed ImageMagick already :S

andersnguyen@andersnguyen-laptop:~/rubyprojects/mediapilot$ display  
-version  
Version: ImageMagick 6.6.0-10 2010-10-07 Q16 [http://www.imagemagick.org](http://www.imagemagick.org)  
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC  
Features: OpenMP

This is a list of the gems I’ve installed and rmagick is in it:

\*\*\* LOCAL GEMS \*\*\*

actionmailer (2.3.5)  
actionpack (2.3.5)  
activerecord (2.3.5)  
activeresource (2.3.5)  
activesupport (2.3.5)  
annotate (2.4.0)  
be\_valid\_asset (1.1.1)  
builder (2.1.2)  
capybara (0.3.9)  
carrierwave (0.4.5)  
celerity (0.7.9)  
childprocess (0.0.7)  
columnize (0.3.1)  
contextually (0.1)  
crack (0.1.8)  
cucumber (0.9.2, 0.8.5)  
cucumber-rails (0.3.2)  
culerity (0.2.12)  
database\_cleaner (0.5.2)  
devise (0.7.5)  
diff-lcs (1.1.2)  
email\_spec (0.3.7)  
faker (0.3.1)  
fakeweb (1.3.0)  
feed\_me (0.7.0)  
ffi (0.6.3)  
formtastic (0.9.8)  
gherkin (2.2.8, 2.1.5)  
gruff (0.3.6)  
has\_scope (0.5.0)  
i18n (0.3.7)  
inherited\_resources (1.0.6)  
jruby (0.0.1)  
json (1.4.6)  
json\_pure (1.4.6)  
linecache (0.43)  
machinist (1.0.6)  
mime-types (1.16)  
mocha (0.9.8)  
mysql (2.8.1)  
nokogiri (1.4.1)  
polyglot (0.3.1)  
prawn (0.8.4)  
prawn-core (0.8.4)  
prawn-fast-png (0.2.1)  
prawn-layout (0.8.4)  
prawn-security (0.8.4)  
rack (1.0.1)  
rack-test (0.5.4)  
rails (2.3.5)  
rails\_sequel (0.2.1)  
rake (0.8.7)  
ramhoj-scruffy (0.2.8)  
random\_data (1.5.1)  
remarkable (3.1.13)  
remarkable\_activerecord (3.1.13)  
remarkable\_rails (3.1.13)  
responders (0.4.7)  
rmagick (2.13.1)  
rspec (1.3.0)  
rspec-rails (1.3.2)  
ruby-debug (0.10.3)  
ruby-debug-base (0.10.3)  
rubygems-update (1.3.7)  
rubyzip (0.9.4)  
savon (0.7.6)  
selenium-webdriver (0.0.29)  
sequel (3.10.0)  
state\_machine (0.8.1)  
term-ansicolor (1.0.5)  
treetop (1.4.8)  
trollop (1.16.2)  
validates\_timeliness (2.3.1)  
warden (0.6.5)  
will\_paginate (2.3.12)  
yalab-ruby-ods (0.0.0)  
ZenTest (4.4.0)

I will try to reinstall ImageMagic and see if there maybe a problem with  
my installation.

Im currently working on ubuntu
