2013-03-23 66 views
-1

我已经安装了红宝石在Windows上轨和MySQL与如何设置护栏和MySQL在Windows

http://railsinstaller.org/

C:\Sites>rails -v 
Rails 3.2.12 

C:\Sites>rails new simple_cms -d mysql 
     create 
     create README.rdoc 
     create Rakefile 
     create config.ru 
     create .gitignore 
     create Gemfile 
     create app 
     create app/assets/images/rails.png 
     create app/assets/javascripts/application.js 
     create app/assets/stylesheets/application.css 
     create app/controllers/application_controller.rb 
     create app/helpers/application_helper.rb 
     create app/views/layouts/application.html.erb 
     create app/mailers/.gitkeep 
     create app/models/.gitkeep 
     create config 
     create config/routes.rb 
     create config/application.rb 
     create config/environment.rb 
     create config/environments 
     create config/environments/development.rb 
     create config/environments/production.rb 
     create config/environments/test.rb 
     create config/initializers 
     create config/initializers/backtrace_silencers.rb 
     create config/initializers/inflections.rb 
     create config/initializers/mime_types.rb 
     create config/initializers/secret_token.rb 
     create config/initializers/session_store.rb 
     create config/initializers/wrap_parameters.rb 
     create config/locales 
     create config/locales/en.yml 
     create config/boot.rb 
     create config/database.yml 
     create db 
     create db/seeds.rb 
     create doc 
     create doc/README_FOR_APP 
     create lib 
     create lib/tasks 
     create lib/tasks/.gitkeep 
     create lib/assets 
     create lib/assets/.gitkeep 
     create log 
     create log/.gitkeep 
     create public 
     create public/404.html 
     create public/422.html 
     create public/500.html 
     create public/favicon.ico 
     create public/index.html 
     create public/robots.txt 
     create script 
     create script/rails 
     create test/fixtures 
     create test/fixtures/.gitkeep 
     create test/functional 
     create test/functional/.gitkeep 
     create test/integration 
     create test/integration/.gitkeep 
     create test/unit 
     create test/unit/.gitkeep 
     create test/performance/browsing_test.rb 
     create test/test_helper.rb 
     create tmp/cache 
     create tmp/cache/assets 
     create vendor/assets/javascripts 
     create vendor/assets/javascripts/.gitkeep 
     create vendor/assets/stylesheets 
     create vendor/assets/stylesheets/.gitkeep 
     create vendor/plugins 
     create vendor/plugins/.gitkeep 
     run bundle install 
Fetching gem metadata from https://rubygems.org/........... 
Fetching gem metadata from https://rubygems.org/.. 
Resolving dependencies... 
Using rake (10.0.3) 
Using i18n (0.6.4) 
Installing multi_json (1.7.0) 
Using activesupport (3.2.12) 
Using builder (3.0.4) 
Using activemodel (3.2.12) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.5) 
Using sprockets (2.2.2) 
Using actionpack (3.2.12) 
Using mime-types (1.21) 
Using polyglot (0.3.3) 
Using treetop (1.4.12) 
Using mail (2.4.4) 
Using actionmailer (3.2.12) 
Using arel (3.0.2) 
Using tzinfo (0.3.37) 
Using activerecord (3.2.12) 
Using activeresource (3.2.12) 
Using bundler (1.3.3) 
Using coffee-script-source (1.6.1) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Installing json (1.7.7) 
Installing rdoc (3.12.2) 
Using thor (0.17.0) 
Using railties (3.2.12) 
Using coffee-rails (3.2.2) 
Using jquery-rails (2.2.1) 
Installing mysql2 (0.3.11) 
Using rails (3.2.12) 
Using sass (3.2.7) 
Using sass-rails (3.2.6) 
Installing uglifier (1.3.0) 
Your bundle is complete! 
Use `bundle show [gemname]` to see where a bundled gem is installed. 
Post-install message from rdoc: 
Depending on your version of ruby, you may need to install ruby rdoc/ri data: 

<= 1.8.6 : unsupported 
= 1.8.7 : gem install rdoc-data; rdoc-data --install 
= 1.9.1 : gem install rdoc-data; rdoc-data --install 
>= 1.9.2 : nothing to do! Yay! 
Post-install message from mysql2: 

================================================================================ 
====================== 

    You've installed the binary version of mysql2. 
    It was built using MySQL Connector/C version 6.0.2. 
    It's recommended to use the exact same version to avoid potential issues. 

    At the time of building this gem, the necessary DLL files where available 
    in the following download: 

    http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0 
.2-win32.zip/from/pick 

    And put lib\libmysql.dll file in your Ruby bin directory, for example C:\Ruby\ 
bin 

================================================================================ 
====================== 


C:\Sites>rails server 
Usage: 
    rails new APP_PATH [options] 

Options: 
    -r, [--ruby=PATH]    # Path to the Ruby binary of your choice 
           # Default: C:/RailsInstaller/Ruby1.9.3/bin/ruby 
.exe 
    -b, [--builder=BUILDER]  # Path to a application builder (can be a files 
ystem path or URL) 
    -m, [--template=TEMPLATE]  # Path to an application template (can be a fil 
esystem path or URL) 
     [--skip-gemfile]   # Don't create a Gemfile 
     [--skip-bundle]   # Don't run bundle install 
    -G, [--skip-git]    # Skip Git ignores and keeps 
    -O, [--skip-active-record]  # Skip Active Record files 
    -S, [--skip-sprockets]   # Skip Sprockets files 
    -d, [--database=DATABASE]  # Preconfigure for selected database (options: 
mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3 
/jdbcpostgresql/jdbc) 
           # Default: sqlite3 
    -j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library 
           # Default: jquery 
    -J, [--skip-javascript]  # Skip JavaScript files 
     [--dev]     # Setup the application with Gemfile pointing t 
o your Rails checkout 
     [--edge]     # Setup the application with Gemfile pointing t 
o Rails repository 
    -T, [--skip-test-unit]   # Skip Test::Unit files 
     [--old-style-hash]   # Force using old style hash (:foo => 'bar') on 
Ruby >= 1.9 

Runtime options: 
    -f, [--force] # Overwrite files that already exist 
    -p, [--pretend] # Run but do not make any changes 
    -q, [--quiet] # Suppress status output 
    -s, [--skip]  # Skip files that already exist 

Rails options: 
    -h, [--help]  # Show this help message and quit 
    -v, [--version] # Show Rails version number and quit 

Description: 
    The 'rails new' command creates a new Rails application with a default 
    directory structure and configuration at the path you specify. 

    You can specify extra command-line arguments to be used every time 
    'rails new' runs in the .railsrc configuration file in your home directory. 

    Note that the arguments specified in the .railsrc file don't affect the 
    defaults values shown above in this help message. 

Example: 
    rails new ~/Code/Ruby/weblog 

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog. 
    See the README in the newly created application to get going. 

C:\Sites>cmd.exe 
Microsoft Windows [Version 6.2.9200] 
(c) 2012 Microsoft Corporation. All rights reserved. 

我可以在浏览器中运行,当我做 C:\网站>导轨新simple_cms ,但得到502错误与 C:\网站>导轨新simple_cms -D mysql

我想获得ruby在rails和mysql一起工作。

回答

0

您将需要在database.yml中设置数据库连接,您还需要为mysql用户设置权限以允许它为您创建数据库。

有很多指南可以做到这一点,如果你谷歌它。

如果这是您第一次使用rails,有一个非常好的教程,涵盖了从安装到相对复杂的应用程序的许多基本设置。

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

+0

我还没有使用数据库。而lynda.com的rails教程教程为教师工作,没有数据库用户名,数据库密码的特殊性。在hello world之前尝试执行项目时,我收到的502错误是在所有页面上的(不需要更改的项目)。 – rails 2013-03-24 18:59:46

+0

感谢您提供丰富的教程。 – rails 2013-04-13 00:01:03