rohith
December 10, 2008, 5:44am
1
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
rohith
December 10, 2008, 6:45am
2
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
rohith
December 10, 2008, 6:51am
3
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…
rohith
December 10, 2008, 6:55am
4
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 <
[email protected] > wrote:
pool: 5
Posted via http://www.ruby-forum.com/ .
–
TWRUG Blog:
http://blog.rubyonrails.org.tw
CFC on Rails:
Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
rohith
December 10, 2008, 7:12am
5
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 <
[email protected] > 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:
Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
rohith
December 10, 2008, 7:01am
6
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??
rohith
December 10, 2008, 7:21am
7
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”
rohith
December 10, 2008, 7:15am
8
no need mysql in your system.
you have to replace database.yml with my database.yml file.
rohith
December 10, 2008, 7:28am
9
I think no need to change socket, just delete it
On Wed, Dec 10, 2008 at 2:25 PM, Air ***
[email protected] wrote:
development:
Posted via http://www.ruby-forum.com/ .
–
TWRUG Blog:
http://blog.rubyonrails.org.tw
CFC on Rails:
Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
rohith
December 10, 2008, 7:25am
11
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”
rohith
December 10, 2008, 7:45am
13
ok… i never used windows for development. ubuntu or linux is good for
development.
rohith
December 10, 2008, 7:36am
14
I know.
I never use socket parameter when I developed on Windows
On Wed, Dec 10, 2008 at 2:30 PM, Air ***
[email protected] wrote:
he was using window xp
Posted via http://www.ruby-forum.com/ .
–
TWRUG Blog:
http://blog.rubyonrails.org.tw
CFC on Rails:
Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
rohith
December 10, 2008, 7:49am
15
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??
rohith
December 10, 2008, 7:55am
16
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’
rohith
December 10, 2008, 7:49am
17
My Database is under Linux machine
rohith
December 10, 2008, 8:06am
18
better go through this “http://fairleads.blogspot.com/ ”. it is more
basic thinks
rohith
December 10, 2008, 8:10am
19
Thanks for that… Can u help me out with some more links???
rohith
December 10, 2008, 8:28am
20
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