ryanb/populator

undefined method 'catch_schema_changes' in Sqlite3 adapter

67ideas opened this issue · 6 comments

Using Rails 3 RC, when I try rake db:populate, I get the below error. Up until a week ago, it worked. I don't think I've changed anything in my environment, but I could be wrong...

rake aborted!
undefined method catch_schema_changes' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x10534b308> /Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/adapters/sqlite.rb:6:inexecute_batch'
/Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/adapters/sqlite.rb:18:in populate' /Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/factory.rb:61:insave_records'
/Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/factory.rb:19:in save_remaining_records' /Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/factory.rb:18:ineach'
/Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/factory.rb:18:in save_remaining_records' /Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/factory.rb:31:inremember_depth'
/Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/factory.rb:42:in populate' /Library/Ruby/Gems/1.8/gems/populator-0.2.5/lib/populator/model_additions.rb:25:inpopulate'
/Users/jack/Work/sportoften/lib/tasks/populate.rake:10
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:insynchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:inload'
/usr/bin/rake:19

I get the same thing.

Me too.
Regards
Rails 3.0 & ruby 1.9.2

Same problem :( with 1.9.2 and rails 3 beta 4 work perfectly

A small bypass. (To be confirmed).

.Env: ubuntu 10.10, rvm 1.01, ruby 1.9.2, rails 3.0.0

sudo updatedb
locate sqlite.rb
At home:
vi ~/.rvm/gems/ruby-1.9.2-p0@demo_ng/gems/populator-0.2.5/lib/populator/adapters/sqlite.rb
Original:
/////
def execute_batch(sql, name = nil)
catch_schema_changes do
log(sql, name) do
@connection.transaction { |db| db.execute_batch(sql) }
end
end
end
/////

Altered:
/////
def execute_batch(sql, name = nil)
#catch_schema_changes do
log(sql, name) do
@connection.transaction { |db| db.execute_batch(sql) }
end
#end
end

/////

Finally,
rake db:populate

runs smoothly for me.

Take a look to: https://rails.lighthouseapp.com/projects/8994/tickets/4988-catch_schema_changes-in-the-sqlite3-adapter-doesnt-actually-do-anything

Regards

thanks ehamon, your solution worked for me. I'm running ruby 1.8.7 (patchlevel 249) and rails 3.0.0.

I'm now working on Rails 3 support. Expect this issue to be resolved in the next release.