Several considerations for first-use Ruby

Source: Internet
Author: User
Tags table name

Today, follow the depot example of the agile Web Development with Rails to automatically generate scaffold from a database table.

That day in the company to do this example, feel quite smooth, did not expect to change to the home today after the machine, there are many problems.

Here is a record of the problems and solutions.

1. After creating a good database and Products table, execute

Cmd>ruby Script/generate Scaffold Product

Result error

Exists app/controllers/

Error Beforeupdatingscaffoldingfromnewdbschema,trycreatingata

Leforyourmodel (Product)

A search on Google, there are about 2 kinds of solutions:

(1) in the Database.yml file, precede the password entry with a space (original address http://www.javaeye.com/post/264530)

(2) The data table name does not have a plural, by default, if the table is products, the command is ... scaffold product

This rule can be modified in the corresponding configuration file, specific Google, here is not much to say.

Both of these methods have been tried, but the problem remains.

(3) accidentally open database.yml file, found that there are a few tips:

#InstalltheMySQLdriver:

# Geminstallmysql

#OnMacOSX:

# geminstallmysql----Include=/usr/local/lib

#OnWindows:

# Geminstallmysql

# Choosethewin32build.

# Installmysqlandputits/bindirectoryonyourpath.

Then the implementation of the gem install MySQL, then the problem was solved. The strange thing is that I am in the same environment as the office, not performing the gem install MySQL, nor has the problem occurred. The only difference, hehe, is probably the slow speed of the home, the gem of the day Intall Rails when

It was interrupted several times, but the problem was solved.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.