Development environment under Windows configuration Rails3

2010-09-16  来源:本站原创  分类:Ruby  人气:229 

Development environment under Windows configuration Rails3

Many students like the Mac website under development with Rails. Unfortunately, I did not condition a few years ago on black. Would also like to play Rails3, then try the next configuration in Windows7 Rails3 development environment. Can not think of pretty simple. The following is the process of recording your own configuration.

An installation Ruby1.9.2
To Rubyforge, download windows version of the installation file. Step by step installation process, select the path when there is attention to detail: By default, ruby ruby will not attach to the windows path, you need to check on the Add Ruby executables to your PATH and Associate. Rb and. Rbw file with this Ruby instakkation, then the next step until the installation is complete.

After installation, added to the windows to see if the path of success: the
Open the doc window (Start - Run (or search for programs and files) - type cmd enter):
ruby-v Enter

The following results came out, the instructions to install successfully, and write windows paths inside the PATH:
C: \ Users \ Administrator> ruby-v Enter
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

By default, the gem is also installed, the version is 1.3.7 see:
C: \ Users \ Administrator> gem-v Enter
1.3.7

2 Installation Rails3
We are a network to install Rails3, it is prerequisite to access to the Internet. Open Doc window, type:
gem install rails - version 3.0.0 Enter

This, windows according to your network, find the source, self-installed. Time spent under the speed of your network, patience and so it wants to.

After installation is complete so dos prompt, type
rails-v Enter the rails to see the corresponding version of the:
C: \ Users \ Administrator> rails-v
Rails 3.0.0

It is very simple.

3 installation database:
Since it is a development environment, I use Sqlite3 as the development database; in dos type:
gem install sqlite3-ruby Enter the gem package sqlite3 installed, there are further needs to be done, otherwise sqlite can not use the rails.
To slqite3 official website, download a sqlite3.dll file (also can be downloaded here), into C: \ Windows \ System32 path, (this path is the path of your windows installation decision, my system is installed in C drive next. or the bin directory under the ruby installation, for example: C: \ Ruby192 \ bin)

If you like mysql, then you can install it:
gem install mysql Enter

Database installation is complete.

Four off the work:
If you have previously installed other versions of rails, to conduct mop-up work, dos, type:
Enter gem cleanup
gem update-y Enter

Five test development environment for convenience, dos down to the root directory C drive new test items:
c: Return
Enter rails new blog
cd blog Enter
rails generate scaffold Post name: string title: string content: text Enter
rake db: migrate Enter
rails s Return

Then type in the browser:
http://127.0.0.1:3000/posts can see the new blog you just had.

The rest is the latest example of official documentation of a blog to study Rails3 it ....( end)

Through the configuration in windows 7, windows xp not done under test.

Reference: http://club.udong.com.cn/group/topic/113758

相关文章