Facing lot of problems while using ROR - mysql

I am new to Ruby on Rails. I have read many article regarding easy installing steps. I installed ruby on windows. After starting the server i got welcome message too. After that if i add a controller I got this message on browser.
And also when tried to do a rake db:migrate i get the error saying mysql gem is missing.
I have installed mysql 5.0. I tried updating gem using this command and got this error.
C:\Documents and Settings\dchannap\Desktop>gem install mysql
ERROR: http://rubygems.org/ does not appear to be a repository
ERROR: Could not find a valid gem 'mysql' (>= 0) in any repository
My gem version is 1.3.7. and ruby is 1.9.1.
Can anyone help me in this regard. I hav to do a project on ROR..

Its probably internet connection or server side problem.
Here is similair question

You'll find it much easier to get started using SQLite3. Why not go with the flow for now? When you need to go more advanced you'll have much more experience with Ruby and Rails and Gems and you'll find it much easier to get sorted.

Are you behind a proxy? In that case you will have to specify it. E.g.
gem install --http-proxy http://your-proxy-address:8080 mysql

Thanks for all the replies.. I learnt Rails on Windows will face problems. And just tried with Instant rails. I faced no problems at all. I am able run small applicatins now.

Related

connect Rails application to a MySQL server

I'm trying to install MySQL adapter to connect my Rails application to a MySQL server, but when I try the command:
gem install mysql2
it return this error message:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.9.1 directory.
How can I fix it?
Thanks,RC
You don't have write permissions into the /Library/Ruby/Gems/1.9 directory.
means exactly that, you don't have permission to write there.
That is the version of Ruby installed by Apple, for their own use. While it's OK to make minor modifications to that if you know what you're doing, because you are not sure about the permissions problem, I'd say it's not a good idea to continue along that track.
Instead, I'll strongly suggest you look into using either rbenv or RVM to manage a separate Ruby, installed into a sandbox in your home directory, that you can modify/fold/spindle/change without worrying about messing up the system Ruby.
Between the two, I use rbenv, though I used RVM a lot in the past. rbenv takes a more "hands-off" approach to managing your Ruby installation. RVM has a lot of features and is very powerful, but, as a result is more intrusive. In either case, READ the installation documentation for them a couple times before starting to install whichever you pick.

unable to launch server, Rails mysql2 gem, windows 7; 193: %1 is not valid win32 application error

First, I've read many other posts, and none of the solutions posted seem to be working. Not sure what im missing exactly, but in any case nothings working. Secondly, I am pretty new to the dev world, ruby, rails and programming.
I've tried copying .dlls from folders and i think i have the 64 bit version installed of my sql and ruby so not sure if thats an issue. I think my processor should be x64 bit but when I look at my system properties it only says windows os 64 bit, nothing about cpu being 64 bit. Could this be an issue? the error msg im reciving when I try to launch rails server from my rails application using:
c:\sites\rails s
I get this:
c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in `requir
e': 193: %1 is not a valid Win32 application. - c:/ruby200-x64/lib/ruby/gems/2
.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so (LoadError)
Followed by more msg.
A few questions I have. Would I be better off installing a partition of linux and doing dev work in that? Also, I am following along with lynda ruby on rails 4 essential training and a lot of it is done on mac. Is this going to be useful being on a windows machine? Would it be easier just using the default database system instead of mysql. My whole goal right now is just to start creating and understanding simple web apps and getting familiar with how the systems work.
What other advice/comments regarding getting into web dev programming and computer tech in general. Any helpful comments greatly appreciated, thanks so much.

ruby on rails with multiple databases ( mongodb, mysql )

I'm planning to use multiple databases (mongodb, mysql) for my project.
And I have no idea with it.
Is there anyone can tell me how to connect mongodb and mysql to rails?
or any references?
Thanks.
-I'm using Ruby 1.9.3 and Rails 3.2
You need to setup your rails project with both of the database connections.
Firstly for Mongo, you need to decide which driver wrapper (if you use one) are you going to use. The two common ones are MongoID & MongoMapper. Both do pretty much the same thing and make it easy to interact with Mongo in a similar fashion to ActiveRecord.
To install these you merely install the appropriate gem e.g. for mongomapper you need to run 'gem install mongomapper'
Follow these Railcasts for step by step instructions:
MongoMapper or
MongoID
Now for mysql, again there is a gem to install, 'gem install mysql', and then follow the instructions on the 'getting started' ruby on rails guide to configure your database files.
Remember for both mongo & mysql you will need to have them installed and running somewhere that it accessible from development environment

How can I make Rails 3.1 work on Debian squeeze with MySQL Server 5.1?

I am trying to start a new application Ruby on Rails 3.1 on Debian Squeeze with MySQL Server 5.1 (the latest supported by Debian stable version).
I have problem with the mysql2 gem. When I use mysql2 gem version 0.2.6 rake migrations fail with error undefined method rows for nil class. I gooogled and everybody says that this error is resolved when one upgrades mysql2 gem to 0.3.X. However, when I do this upgrade I get another error about gem having been compiled for 5.5 mysql client and not 5.1.
Any help would much appreciated. Maybe the answer is "NO. YOU CANNOT DO IT". Even then, I want to know that.
Thanks in advance
Panayotis
Well, this is a tricky question. My current rails package latest version is 2.3.5-1.2+squeeze2 and the current mysql-server package is 5.1.49-3, both from the stable debian repositories.
However, you're trying to install RoR 3.1. That means you're not on stable or you are not trying to install it from any of the official debian repository at all (it is not wheeze nor sid).
If you can install the stable version of rails, go ahead and I bet you won't have any trouble. Otherwise, if you want the most current release I'm pretty sure you'll have to go for the dirty way. It might probably involve download a 5.5 MySQL (not from the repositories, because it isn't there) and messing with the libraries.
Remember if you require newer packages (such as newer libraries) and you don't want to use the testing repositories, you can always give debian backports a try.

Incompatibily between ruby and mysql gem

When trying to install the mysql gem from cPanel on my website, I get an error saying that the gem requires Ruby >= 1.8.6.
This is a shared server and the version of Ruby is 1.8.5 and can't be upgraded.
I do not have shell access and it seems the only way for me to install a gem is through the list of gems within cPanel.
How can I get mysql for my website?
You can try to install an older gem. 2.7.5 seems to be the proper version.
Ruby 1.8.5 is pretty old and as far as I know hasn't been actively supported by Rails for a while. You really need 1.8.6 and preferably 1.8.7. If your host won't upgrade it may be time to look elsewhere. If you really have no other option, you should to what Yuval suggests and try installing an older version of the gem.
No one having answered how to install a gem without shell access, I'll assume it can't be done and so will accept my own answer.