Forum: Ruby on Rails I am New to Ruby..Please Help me ON start

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 05:44
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
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 06:45
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
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 06:51
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...
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2008-12-10 06:55
(Received via mailing list)
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 ]

On Wed, Dec 10, 2008 at 1:51 PM, Rohith Nair <
rails-mailing-list@andreas-s.net> wrote:

>  pool: 5
>
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
TWRUG Blog:
http://blog.rubyonrails.org.tw

CFC on Rails:
http://zusocfc.blogspot.com

Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 07:01
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??
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2008-12-10 07:12
(Received via mailing list)
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

On Wed, Dec 10, 2008 at 2:01 PM, Rohith Nair <
rails-mailing-list@andreas-s.net> wrote:

> # SQLite version 3.x
> test:
>
>
> Is all correct??
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
TWRUG Blog:
http://blog.rubyonrails.org.tw

CFC on Rails:
http://zusocfc.blogspot.com

Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 07:15
Attachment: database.yml (1 KB)
no need mysql in your system.

you have to replace database.yml with my database.yml file.
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 07:21
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"
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 07:25
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"
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2008-12-10 07:28
(Received via mailing list)
I think no need to change socket, just delete it :)

On Wed, Dec 10, 2008 at 2:25 PM, Air ***
<rails-mailing-list@andreas-s.net>wrote:

> development:
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
TWRUG Blog:
http://blog.rubyonrails.org.tw

CFC on Rails:
http://zusocfc.blogspot.com

Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 07:29
Attachment: database.yml (1 KB)
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"
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 07:30
he was using window xp
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2008-12-10 07:36
(Received via mailing list)
I know.
I never use socket parameter when I developed on Windows :P

On Wed, Dec 10, 2008 at 2:30 PM, Air ***
<rails-mailing-list@andreas-s.net>wrote:

>
> he was using window xp
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
TWRUG Blog:
http://blog.rubyonrails.org.tw

CFC on Rails:
http://zusocfc.blogspot.com

Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 07:45
ok.. i never used windows for development. ubuntu or linux is good for
development.
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 07:49
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??
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 07:49
My  Database is under Linux machine
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 07:55
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'
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 08:06
better go through this "http://fairleads.blogspot.com/". it is more
basic thinks
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 08:10
Thanks for that.. Can u help me out with some more links???
2657bfd188c957907cfb4b7076dc224d?d=identicon&s=25 Air genruby@googlegroups (rider)
on 2008-12-10 08:11
 also
   http://www.tutorialspoint.com/ruby-on-rails/index.htm
   http://www.tutorialspoint.com/ruby-on-rails-2.1/index.htm

 also search to get book "Agile Web Development with Rails " 3rd
edition. it ll helpful for u..
Dda5725cb6af653b696aa1008ff70d36?d=identicon&s=25 Rohith Nair (rohith)
on 2008-12-10 08:28
Thanks for that tooo

Now i did one cmd command

"rake db:create:all"

Its shows like Only modify the local one. U cant do the current database
remoteHost
D93ae163042e0a937941e0ba4d8ed5d7?d=identicon&s=25 Eric Hill (Guest)
on 2008-12-10 09:56
(Received via mailing list)
> 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
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2008-12-10 09:59
(Received via mailing list)
Agree..
But, I using Mac right now :P

On Wed, Dec 10, 2008 at 2:45 PM, Air genruby@googlegroups <
rails-mailing-list@andreas-s.net> wrote:

>
> ok.. i never used windows for development. ubuntu or linux is good for
> development.
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
TWRUG Blog:
http://blog.rubyonrails.org.tw

CFC on Rails:
http://zusocfc.blogspot.com

Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
D93ae163042e0a937941e0ba4d8ed5d7?d=identicon&s=25 Eric Hill (Guest)
on 2008-12-10 10:01
(Received via mailing list)
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/Instan...

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

-eric
This topic is locked and can not be replied to.