I am New to Ruby..Please Help me ON start

Hello All...

I am new to ruby...

I have installed ruby 1.8.6 in my XP machine.

Installed by Ruby one-click installer. And then i have installed Apache2 Webserver.

Then tried with a testProgram in Run-> cmd -> rails testProgram

Then i have completed ruby script/server on cmd

Then after that i took http://127.0.0.1:3000/ in my browser and i got the default page.

It contains the details like

          "Welcome Abroad"           About your application Environment with a link.

Once i click on that I got Like "MissingSourceFile in Rails/...

no such file to load -- sqlite3

RAILS_ROOT: C:/Ruby/testProgram

I need to use the mysql as database.

The mysql server is therre in another machine in my LAN. I dont know how to connect to that..

And also I am so srry to ask this simple doubt but im new to thias ruby.

I want to to knw how can i start by simply print or start with ruby page by a message "Welcome to RUBY". Where can i start with? How??

Hope some one help me out

no such file to load – sqlite3

RAILS_ROOT: C:/Ruby/testProgram

I need to use the mysql as database.

Apparently the mysql gem is currently broken for Windows, so you should probably get used to using SQLite for now.

-e

Just to follow up, I was able to get rake to run on Windows under 2.2.2 by using the InstantRails fix:

http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/

  1. Copy libmysql.dll from there to your ruby/bin directory
  2. gem install mysql --no-rdoc

-eric

hi

your rails app folder, go to config/database.yml

in datebase.yml

you will find like this

development:   adapter: mysql   database: test   username: root   password: password   host: localhost   socket: /var/run/mysqld/mysqld.sock

in host your that system ip like

  adapter: mysql   database: test   username: root   password: password   host: 10.0.1.28   socket: /var/run/mysqld/mysqld.sock

Thanks for ur reply...

In database.yml i can find this

# SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development:   adapter: sqlite3   database: db/development.sqlite3   pool: 5   timeout: 5000

# Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test:   adapter: sqlite3   database: db/test.sqlite3   pool: 5   timeout: 5000

production:   adapter: sqlite3   database: db/production.sqlite3   pool: 5   timeout: 5000

I didnt install Mysql in my PC...

If you will not use any database, you can cancel active_record. Modify config/environment.rb Uncomment this line:

config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

Thank you for the reply

Now i got message by clicking on the link ' About your application Environment' as

"uninitialized constant ActiveRecord::Base"

ok...And my databasse.yml is like this..

# SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development:   adapter: sqlite3   database: db/development.sqlite3   pool: 5   timeout: 5000

# Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test:   adapter: sqlite3   database: db/test.sqlite3   pool: 5   timeout: 5000

production:   adapter: sqlite3   database: db/production.sqlite3   pool: 5   timeout: 5000

Is all correct??

err … Did you generated any model yet? And SQLite is not same as MySQL, they are different. Run cmd and type: gem i sqlite3-ruby And comment config.frameworks -= [ :active_record, :active_resource, :action_mailer ] And, restart your server and try again

no need mysql in your system.

you have to replace database.yml with my database.yml file.

Attachments: http://www.ruby-forum.com/attachment/3048/database.yml

Thanks Air...

How can i do that?? How can i replace as my database.yml??

And billy...

Wat u mean by generating model?

i didn't do anything yet..

Just reached in the start up screen telling the message "Welcome abroad"

Air *** wrote:

no need mysql in your system.

you have to replace database.yml with my database.yml file.

Delete your database.yml. then copy my "database.yml" i was attached after that then change follow thinks

development:   adapter: mysql   database: test   username: root   password: password   host: localhost   socket: /var/run/mysqld/mysqld.sock

change socket to "socket = C:/www/tmp/mysql.sock"

I think no need to change socket, just delete it :slight_smile:

use this

Air *** wrote:

Air *** wrote:

no need mysql in your system.

you have to replace database.yml with my database.yml file.

Delete your database.yml. then copy my "database.yml" i was attached bfter that then change follow thinks

development:   adapter: mysql   database: test   username: root   password: password   host: localhost   socket: /var/run/mysqld/mysqld.sock

change socket to "socket = C:/www/tmp/mysql.sock"

Attachments: http://www.ruby-forum.com/attachment/3049/database.yml

he was using window xp

I know. I never use socket parameter when I developed on Windows :stuck_out_tongue:

Thanks friends...

Now i used that database.yml that given.

And then i have started the cmd -> ruby script/server

Then re started my browser. Then got the starting page..

Click on the link and and got the details...

This is the details

Ruby version 1.8.6 (i386-mswin32) RubyGems version 1.3.1 Rails version 2.2.2 Active Record version 2.2.2 Action Pack version 2.2.2 Active Resource version 2.2.2 Action Mailer version 2.2.2 Active Support version 2.2.2 Application root C:/Ruby/TestOne Environment development Database adapter mysql Database schema version 0

I think it is all correct...I have used a database ame that aleready exist in mysql

Is it all correct?? Then What is to do next? I mean i dnt knw how can i program on this ruby..initial simple program and need to knw wethr it is actually connected to the DB...Means shall i take any data from the Db in order to confirm??

My Database is under Linux machine

And again...

I have created another controller by taking CMD -> ruby script/generate controller test

Then i edit the test_controller under app/controller

class TestController < ApplicationController   def index           render_text "Test The Message"     end end

But once i test it with http://127.0.0.1:3000/test/

I got an error message :

NoMethodError in TestController#index undefined method `render_text' for #<TestController:0x465f078> RAILS_ROOT: C:/Ruby/TestOne

app/controllers/test_controller.rb:3:in `index'

better go through this "http://fairleads.blogspot.com/&quot;\. it is more basic thinks

Thanks for that.. Can u help me out with some more links???