简体   繁体   中英

Ruby on Rails 3.1.1 on Mac OSX 10.5.8

For the past few months I've been learning and coding successful apps and websites in RoR, I recently upgraded from rails 3.0.9 to rails 3.1.1 and since then I can't get sqlite3 to work, I'm guessing because OSX 10.5.8.

Can anyone please assist with this problem as it's kinda' putting a dint in my learning and stopping my Rails progress. (Many thanks in advance if anyone can help with this problem)

I have searched all over the internet and Google and found several possible solutions to this problem but none have helped so far, I have also browsed the Rails forums and found someone with a similar problem but again no one posted replies on how to solve it. Please find specific details below:

Link to rails forums where someone has the exact same problem: http://railsforum.com/viewtopic.php?pid=146751#p146751

command :

$ rake db:create 

Error message:

Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)
/Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection'
/Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:68:in `establish_connection'

When I try to gem install activerecord-sqlite3-adapter I get the following error:

ERROR:  Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any repository

I seems to be caused by the following SQLite version which as far to my knowledge is the only one which works on this version of MAC OSX:

gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'

If anyone can help with this problem I'd be extremely grateful.

Gemfile

source 'http://rubygems.org'

gem 'rails', '3.1.1'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
gem 'will_paginate'

group :development do
gem 'rspec-rails'
gem 'annotate'
end 

group :test do
gem 'rspec-rails'
gem 'webrat'
gem 'spork'
end 

group :assets do
  gem 'sass-rails',   '~> 3.1.4'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

When gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' is changed to gem 'sqlite3' i get the following errors:

MHcomp-2:test_app rubyadmin$ rake db:create dyld: lazy symbol binding failed: Symbol not found: _sqlite3_open_v2 Referenced from: /Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.bundle Expected in: flat namespace dyld: Symbol not found: _sqlite3_open_v2 Referenced from: /Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.bundle Expected in: flat namespace

Fixed, if anyone needs help with this it's a curl problem with mac.

sudo port -f upgrade curl +ssl

fixed the issue I was having.

Replace. "gem 'sqlite3-ruby', '1.2.5'. :require => 'sqlite3' "

with

gem 'sqlite3'

Then run "bundle update"

您是否尝试删除此捆绑包?

sudo rm -f /Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.bundle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM