Problem with ferret and fixtures:load

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’, ‘[email protected]’)”

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

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’, ‘[email protected]’)”

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

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’, ‘[email protected]’)”

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