# Problem with ferret and fixtures:load

**URL:** <https://www.ruby-forum.com/t/problem-with-ferret-and-fixtures-load/146938>\
**Category:** Rails\
**Created:** [August 26, 2008, 11:50pm UTC](https://www.ruby-forum.com/t/problem-with-ferret-and-fixtures-load/146938 "2008-08-26T23:50:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![noelnoelu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@noelnoelu](https://www.ruby-forum.com/u/noelnoelu)\
**Post date:** [August 26, 2008, 11:50pm UTC](https://www.ruby-forum.com/t/problem-with-ferret-and-fixtures-load/146938/1 "2008-08-26T23:50:26Z")

</div>

I use acts\_as\_ferret to my business model, and it work very well in  
development env.  
However, the problem is when I try to rake db:fixtures:load, it always  
show an errors

“Mysql::Error: Unknown column ‘log\_file’ in ‘field list’: INSERT INTO  
`businesses` (`city`, `address1`, `updated_at`, `zip`, `logo`,  
`busname`, `id`, `lng`, `log_file`, `port`, `description`, `fax`,  
`phone`, `first_name`, `host`, `lat`, `last_name`, `log_level`,  
`pid_file`, `created_at`, `state`, `email`) VALUES (‘New York’, ‘106  
Bayard St’, ‘2008-08-26 14:28:47’, 10013, ‘tonys\_pizza\_logo’, ‘Tony’s  
Pizza’, 569266725, -74.008878, ‘log/ferret\_server.log’, 9010, ‘The  
best place to get pizza!’, ‘7776662222’, ‘8887772222’, ‘Tony’,  
‘localhost’, 40.72092, ‘DiMaggio’, ‘warn’, ‘log/ferret.pid’,  
‘2008-08-26 14:28:47’, ‘NY’, ‘removed\_email\_address@domain.invalid’)”

My business schema does not have any one log\_file, host, port,  
pid\_file, log\_level. (I belive these field come from ferret), I think  
that ferret trying to put this filed into the database with the  
object. does any one know how to fix this problem. Inaddtion, the  
following code is in my business model

class Business \< ActiveRecord::Base

acts\_as\_ferret :fields=\>[:coupon\_title, :busname],  
:ferret=\>{:or\_default=\>true}

has\_many :coupons

private

def coupon\_title  
return coupons.collect{|c| c.title}.uniq.join(’ ')  
end

end

---

<div class="post-metadata">

**Author:** ![noelnoelu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@noelnoelu](https://www.ruby-forum.com/u/noelnoelu)\
**Post date:** [August 27, 2008, 1:08am UTC](https://www.ruby-forum.com/t/problem-with-ferret-and-fixtures-load/146938/2 "2008-08-27T01:08:16Z")

</div>

I finally solved this and this is the stupidest bug that I have ever  
seen.

The problem is that my businesses fixture have function to generate data

business1:  
username: business1  
encrypted\_password: Business.encrypt\_password(password)  
…

that function cause fixture gone wild with ferret and cause the error  
message

after I remove and put the raw password everything work fine.

noelnoelu wrote:

> I use acts\_as\_ferret to my business model, and it work very well in  
> development env.  
> However, the problem is when I try to rake db:fixtures:load, it always  
> show an errors
> 
> “Mysql::Error: Unknown column ‘log\_file’ in ‘field list’: INSERT INTO  
> `businesses` (`city`, `address1`, `updated_at`, `zip`, `logo`,  
> `busname`, `id`, `lng`, `log_file`, `port`, `description`, `fax`,  
> `phone`, `first_name`, `host`, `lat`, `last_name`, `log_level`,  
> `pid_file`, `created_at`, `state`, `email`) VALUES (‘New York’, ‘106  
> Bayard St’, ‘2008-08-26 14:28:47’, 10013, ‘tonys\_pizza\_logo’, ‘Tony’s  
> Pizza’, 569266725, -74.008878, ‘log/ferret\_server.log’, 9010, ‘The  
> best place to get pizza!’, ‘7776662222’, ‘8887772222’, ‘Tony’,  
> ‘localhost’, 40.72092, ‘DiMaggio’, ‘warn’, ‘log/ferret.pid’,  
> ‘2008-08-26 14:28:47’, ‘NY’, ‘removed\_email\_address@domain.invalid’)”
> 
> My business schema does not have any one log\_file, host, port,  
> pid\_file, log\_level. (I belive these field come from ferret), I think  
> that ferret trying to put this filed into the database with the  
> object. does any one know how to fix this problem. Inaddtion, the  
> following code is in my business model
> 
> class Business \< ActiveRecord::Base
> 
> acts\_as\_ferret :fields=\>[:coupon\_title, :busname],  
> :ferret=\>{:or\_default=\>true}
> 
> has\_many :coupons
> 
> private
> 
> def coupon\_title  
> return coupons.collect{|c| c.title}.uniq.join(’ ')  
> end
> 
> end

---

<div class="post-metadata">

**Author:** ![noelnoelu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ea924/32.png) [@noelnoelu](https://www.ruby-forum.com/u/noelnoelu)\
**Post date:** [January 24, 2009, 12:50am UTC](https://www.ruby-forum.com/t/problem-with-ferret-and-fixtures-load/146938/3 "2009-01-24T00:50:15Z")

</div>

I actually had the same problem, and removing all functions that  
generated data did not help. With some tracing, I think the problem is  
causing by some threading issue. But anyway, I modified (after making  
the file writable) fixtures.rb (on my machine in  
/usr/lib/ruby/gems/1.8/gems/active-record-2.1.2/lib/active\_record

I changed the line  
@connection.insert\_fixture(fixture, @table\_name)

to:

begin  
@connection.insert\_fixture(fixture, @table\_name)  
rescue  
puts “ERROR in fixtures.rb: failed to insert fixture  
#{fixture.to\_s} into #{@table\_name.to\_s}”  
end

The error message gets generated once, but now it does not stop loading  
my fixtures.

A real solution would of course be better. But after a day of struggling  
I gotta get back to doing productive things

Regards

Nat Amontananuban wrote:

> I finally solved this and this is the stupidest bug that I have ever  
> seen.
> 
> The problem is that my businesses fixture have function to generate data
> 
> business1:  
> username: business1  
> encrypted\_password: Business.encrypt\_password(password)  
> …
> 
> that function cause fixture gone wild with ferret and cause the error  
> message
> 
> after I remove and put the raw password everything work fine.
> 
> noelnoelu wrote:
> 
> > I use acts\_as\_ferret to my business model, and it work very well in  
> > development env.  
> > However, the problem is when I try to rake db:fixtures:load, it always  
> > show an errors
> > 
> > “Mysql::Error: Unknown column ‘log\_file’ in ‘field list’: INSERT INTO  
> > `businesses` (`city`, `address1`, `updated_at`, `zip`, `logo`,  
> > `busname`, `id`, `lng`, `log_file`, `port`, `description`, `fax`,  
> > `phone`, `first_name`, `host`, `lat`, `last_name`, `log_level`,  
> > `pid_file`, `created_at`, `state`, `email`) VALUES (‘New York’, ‘106  
> > Bayard St’, ‘2008-08-26 14:28:47’, 10013, ‘tonys\_pizza\_logo’, ‘Tony’s  
> > Pizza’, 569266725, -74.008878, ‘log/ferret\_server.log’, 9010, ‘The  
> > best place to get pizza!’, ‘7776662222’, ‘8887772222’, ‘Tony’,  
> > ‘localhost’, 40.72092, ‘DiMaggio’, ‘warn’, ‘log/ferret.pid’,  
> > ‘2008-08-26 14:28:47’, ‘NY’, ‘removed\_email\_address@domain.invalid’)”
> > 
> > My business schema does not have any one log\_file, host, port,  
> > pid\_file, log\_level. (I belive these field come from ferret), I think  
> > that ferret trying to put this filed into the database with the  
> > object. does any one know how to fix this problem. Inaddtion, the  
> > following code is in my business model
> > 
> > class Business \< ActiveRecord::Base
> > 
> > acts\_as\_ferret :fields=\>[:coupon\_title, :busname],  
> > :ferret=\>{:or\_default=\>true}
> > 
> > has\_many :coupons
> > 
> > private
> > 
> > def coupon\_title  
> > return coupons.collect{|c| c.title}.uniq.join(’ ')  
> > end
> > 
> > end
