ROR environmental configuration (rails2.2.2 fell from 1.2.6)

ROR environment structures put my steps down - Memo

2009.1.26

ROR online to find some tutorials are ruby 1.8.5, rails1.2.6 to do based on the demonstration

I use the version downloaded from the Internet are the latest version at the installation encountered some problems, are now recorded.

OS: Win XP

One-Click Installer version 1.8.6 -27 (ruby)

Well-being in early MYsql5.0.18, security at the D: \ MySQL \ MySQL Server 5.0 \ bin \ Internet Say, the path has spaces may be wrong, did not control him.

1: the latest version of the One-Click Ruby Installer for Windows can http://rubyforge.org/frs/?group_id=167 Download

Installed after the windows at the CMD window run command ruby-v show version is 1.8.6.

Gem install and hook on to, to be a manager. Run gem-v shows 1.3.1

2: gem install rails-remote
This Order is explicit from the remote server is installed on rails, you can also run gem install rails to install, gem will be installed to determine whether the local rails, thereby to determine whether remote installation from the rails.

Run rails-v show version is 2.2.2

Can also run gem list - local to see what packages are installed,

Similar to the following path to see something. The package files are rails with ruby installed in the same directory.
C: \ ruby \ lib \ ruby \ gems \ 1.8 \ gems

And at C: \ ruby \ bin under rails.cmd add a document.

3: I put the project on the E: \ rails \ below, the name of pic, to enter the E: \ rails \

rails pic-d mysql

rails2.0 the default database is sqlite3, and rails1.2.6 the default database is mysql, and I have mysql database,
Set up the project with: rails projectname-d mysql

4: revise my WEB projects under E: \ rails \ pic \ config \ database.yml For example:

development:
adapter: mysql
encoding: utf8
database: here is my database name pool: 5
username: root
password: 1234
host: localhost

5: Entering E: \ rails \ pic \, enter the ruby script \ server, start the WEB server: WEBrick

Want to stop the web server with ctrl + c keys, you can.

6: Open IE, enter the http://127.0.0.1:3000 Click on About your application's environment error

7: online gogle one pass, an a: gem install sqlite3-ruby - version = 1.2.3, not effective

8: another google one pass, an a gem install mysql, open IE click on About your application's environment is also an error, but the error is different, that it can not find libmySQL.dll, one search at the local hard disk 5 libmySQL.dll available to the system appears moment I do not know which is correct

With the election of the first, copy to c: \ ruby \ bin, on the OK, and finally see the configuration.

9: Entering E: \ rails \ pic>, run ruby script \ generate model sy_user, sy_user me are the table name. There are data

10: Run ruby script \ generate controller sy_user

11: amend the E: \ rails \ pic \ app \ controllers \ sy_user_controller.rb, in the middle add scaffold: sy_user,

scaffold: sy_user - this is your only required to write the code, it generates a database table corresponding to CRUD operations, but also exciting is that it generates the corresponding view template file.

class SyUserController < ApplicationController
	scaffold:sy_user
end

12: Entering the http://127.0.0.1:3000/sy_user/new The following error

NoMethodError in Sy userController # new

undefined method `scaffold' for SyUserController:Class

Google pass one another, said yes to an Scaffolding plug-ins. TMD many things really. ...... No get

13: Finally decided to uninstall rails2.2.2, Simon had 1.2.6, I bought the book is the sense of 1.2.6

Uninstall: gem uninstall rails

Install the old version: gem install rails-v 1.2.6 a few minutes, etc., are installed online.

14: Re-implementation of Step 5, start the web server, a number of normal.

15: Another step-by-step implementation of 9,10,11.

16: Start Web server, enter http://127.0.0.1:3000/sy_user/new That can not find sy_users table, table name behind many an "s", then google one pass, saying that Rails is always assumed that the table name plural. I have also established a new sy_users table,

Table one more S. Enter http://127.0.0.1:3000/sy_user/new OK, successful, at least to see a set of CURD.

17: first engage in ROR, download at official online are the latest version, did not get, but to lower version.

分类:Ruby 时间:2009-03-15 人气:1253
分享到:
blog comments powered by Disqus

相关文章

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.397 (s). 15 q(s)