Forum: Ruby on Rails “Add 'gem sqlite3'' to your Gemfile”

Ae6c3e0f01d8162072db25f9a6d863b1?d=identicon&s=25 Matt Hall (hewhocomes)
on 2013-06-27 22:31
Hello World!

I'm a complete n00b on Rails with only beginner knowledge of Ruby. I
plan on studying Ruby more before I really learn Rails, but I'm waayy
too curious for my own good.

Anyway, I was following the tutorial, but I got stuck when it said to
type "rails server" in the blog directory. It states, "Specified
'sqlite3' for database adapter, but the gem is not loaded. Add gem
'sqlite3' to your Gemfile." So I quit the server, installed sqlite3,
reinstated the server...only to get this message again. sqlite3 doesn't
show up when I do "gem list", but I do see the folder in my Root Ruby
directory.

If it helps, I got Ruby 2.0, Rails 4.0, sqlite3 1.3.7

I apologize if this was answered already somewhere else, but I couldn't
find anything in the vast database that is stackoverflow. I would
appreciate any patience that you are willing to provide.

Thank you very much! hewhocomes
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2013-06-27 22:43
(Received via mailing list)
On 27 June 2013 21:31, Matt Hall <lists@ruby-forum.com> wrote:
> Hello World!
>
> I'm a complete n00b on Rails with only beginner knowledge of Ruby. I
> plan on studying Ruby more before I really learn Rails, but I'm waayy
> too curious for my own good.
>
> Anyway, I was following the tutorial,

Which tutorial and what Operating System are you using (Windows 7,
Ubuntu etc)?

> but I got stuck when it said to
> type "rails server" in the blog directory. It states, "Specified
> 'sqlite3' for database adapter, but the gem is not loaded. Add gem
> 'sqlite3' to your Gemfile." So I quit the server, installed sqlite3,

It did not say to install sqlite3 (though this may be necessary) it
said to add it to Gemfile.  In fact you may just have to uncomment it
in Gemfile.  You should then run bundle install which should install
the gem.  I am surprised the tutorial did not cover this, assuming
that it is a Rails 4 tutorial.

Colin
Ae6c3e0f01d8162072db25f9a6d863b1?d=identicon&s=25 Matt Hall (hewhocomes)
on 2013-06-27 22:54
Hi Colin,

Thank you for your quick reply!

I am using Windows 7. Ruby works fine as I've been using cmd prompt and
irb to experiment with Ruby. The tutorial is "Getting Started with
Rails" (http://guides.rubyonrails.org/getting_started.html). I got stuck
at the beginning of 4. Hello, Rails!.

When I initially tried to install rails, it failed and asked me to
download the DevKit. I followed all the instructions on that correctly.
Then I tried installing rails again and it had a bunch of "could not
convert ASCII-8BIT to UTF-8" and skipped those files. It wasn't until I
got stuck with this error (see post above) that I installed sqlite3.
When I installed sqlite3, it said something about being added to Gemfile
list (if I remember right). I still don't see it when I do gem list.

I did discover sqlite3 in Gemfile.lock and the text: "# Use sqlite3 as
the database for Active Record
gem 'sqlite3'" in Gemfile in the root directory of the blog the tutorial
asked me to make.

Thanks once again!
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2013-06-27 23:14
(Received via mailing list)
On 27 June 2013 21:54, Matt Hall <lists@ruby-forum.com> wrote:
> Hi Colin,
>
> Thank you for your quick reply!
>
> I am using Windows 7.

Most RoR developers use Linux (eg Ubuntu) or Mac.  I believe it is
possible to use Windows but you will find it more difficult to get
support as so few use it.  I advise using Ubuntu either by dual
booting the PC or running it in a virtual machine.

I usually recommend railstutorial.org for beginners.

> When I installed sqlite3, it said something about being added to Gemfile
> list (if I remember right). I still don't see it when I do gem list.

I suspect the encoding issues are Windows problems.

>
> I did discover sqlite3 in Gemfile.lock and the text: "# Use sqlite3 as
> the database for Active Record
> gem 'sqlite3'" in Gemfile in the root directory of the blog the tutorial
> asked me to make.

I don't quite understand what you are saying above.  You should not
edit Gemfile.lock, you should edit Gemfile.  Then run
bundle install
in a terminal.  That should install the gem and update Gemfile.lock.
However, since you are using Windows, I don't know whether there are
other issues.

Colin
15eb13d662803f57bc4aea59704988b4?d=identicon&s=25 Scott Ribe (Guest)
on 2013-06-27 23:58
(Received via mailing list)
On Jun 27, 2013, at 3:12 PM, Colin Law wrote:

> I suspect the encoding issues are Windows problems.

Installing on OSX gives a batch of encoding errors as well. They're all
rdoc-related, and I've always just ignored them, but they'd be
concerning to a newbie--especially one who's having trouble getting
started ;-)

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice
Ae6c3e0f01d8162072db25f9a6d863b1?d=identicon&s=25 Matt Hall (hewhocomes)
on 2013-06-28 00:53
Hi guys,

Thanks again for the replies. I did a bundle install. When I did the
command, "bundle show sqlite3", it replies with, "Could not find gem
'sqlite3'. Did you mean sqlite3?"


What I meant earlier is the following:

Gemfile has the following text:
# Use sqlite3 as the database for Active Recordgem 'sqlite3'

I only have Notepad to view this information, so it just looks like a
long line of text.

Gemfile.lock has the following text:
sqlite3 (1.3.7-x86-mingw32)

I also the following text in Gemfile.lock:
sqlite3

This files already had this text here without me doing anything.

It would be my preference to not have to learn an entire OS just because
I want to be able to program. I understand that people have strong
preferences and that if I understand more of what I'm doing and how
computers work, then I too may develop said preferences. Right now, I
just want to play with Rails and Ruby. That's all...nothing fancy. If
those who made it say it works on Windows, it works on Windows.

If this error really is an rDoc issue...I've already updated rDoc and I
still have the same Gem::LoadError (Specified 'sqlite3' for database
adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your
Gemfile.)

Thanks again!
15eb13d662803f57bc4aea59704988b4?d=identicon&s=25 Scott Ribe (Guest)
on 2013-06-28 05:32
(Received via mailing list)
On Jun 27, 2013, at 4:53 PM, Matt Hall wrote:

> If
> those who made it say it works on Windows, it works on Windows.

It does work on Windows, but very few people use it on Windows, so very
few people will be able to help you with Windows-specific questions.

Although, once you get started, that won't matter nearly as much.

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice
14b5582046b4e7b24ab69b7886a35868?d=identicon&s=25 Joel Pearson (virtuoso)
on 2013-06-30 13:56
Attachment: sqlite.zip (1 MB)
There's a quick guide on how to install Sqlite3 on Windows 7 here:

http://www.ruby-forum.com/topic/4413168

I followed the instructions on there, and after a few minor tweaks, I
managed to get it working.

I've tried to attach a zip with the necessary files in. Hopefully if you
can download that you can drop it into a folder like c:/rails, making it
c:/rails/sqlite, and then run this command:

gem install sqlite3 --platform=ruby --
--with-sqlite3-include=c:/rails/sqlite/include
--with-sqlite3-lib=c:/rails/sqlite/lib
--with-sqlite3-dir=c:/rails/sqlite/bin

Sometimes running "bundle install" on a Rails project can install a
conflicting version of the sqlite gem, so make sure you've only got 1
version after using bundle.

It helps to put sqlite3.def and sqlite3.dll somewhere in your path, like
in your Ruby bin folder.
Ae6c3e0f01d8162072db25f9a6d863b1?d=identicon&s=25 Matt Hall (hewhocomes)
on 2013-07-01 19:10
It works! It works!

Thank you, Mr. Pearson. I was able to download your sqlite files and
follow your instructions and it worked. I had trouble using the guide
you linked. The directions were clear, but my environment didn't like
the filed it extracted because it couldn't find the libversion_number
file. Your attachment worked, though! It's a shame that sqlite.com
doesn't provide these files.

Thank you very much for your clear instructions! I linked this topic on
my question in stackoverflow to show other how it works on Windows.

http://stackoverflow.com/questions/17350837/ruby-o...

Rails shows me the appropriate Welcome screen and everything! Thank you
very much everyone, for giving this n00b advice and direction! I do feel
like I understand how Ruby and Rails word on my system a little better.

Thank you!
hewhocomes
14b5582046b4e7b24ab69b7886a35868?d=identicon&s=25 Joel Pearson (virtuoso)
on 2013-07-01 20:37
No problem, we're here to help :)
2324750d63fe7ecb011bb3d72dd6849a?d=identicon&s=25 "Константин Медведев" <k.p.medvedev@gmail.com> (Guest)
on 2013-07-22 23:23
(Received via mailing list)
On Friday, 28 June 2013 02:53:20 UTC+4, Ruby-Forum.com User wrote:

> Hi guys,
>
> I only have Notepad to view this information, so it just looks like a
> long line of text.
>
> Gemfile.lock has the following text:
> sqlite3 (1.3.7-x86-mingw32)
>

I had the same troulbe on Windows7-x64 even I made everything according
to
https://www.ruby-forum.com/topic/4413168
Then I opened Gemfile.lock file and just edit this row to "sqlite3
(1.3.7-x64-mingw32)" and run server again - it worked correct. Hope it
will
help somebody
Acae89b6fcce79be1560ed4a918f7bdf?d=identicon&s=25 Ison Daya (alan_m62)
on 2013-08-20 22:08
"Константин Медведев" <k.p.medvedev@gmail.com> wrote in post #1116282:
> On Friday, 28 June 2013 02:53:20 UTC+4, Ruby-Forum.com User wrote:
>
>> Hi guys,
>>
>> I only have Notepad to view this information, so it just looks like a
>> long line of text.
>>
>> Gemfile.lock has the following text:
>> sqlite3 (1.3.7-x86-mingw32)
>>
>
> I had the same troulbe on Windows7-x64 even I made everything according
> to
> https://www.ruby-forum.com/topic/4413168
> Then I opened Gemfile.lock file and just edit this row to "sqlite3
> (1.3.7-x64-mingw32)" and run server again - it worked correct. Hope it
> will
> help somebody

That helped so much. I don't know why it was insisting on using the x86
version, which of course didn't exist.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.