---
title: "Cygwin下玩Rails on ruby的一些心得"
author: "wikimo"
date: "2010-03-09T19:31:39Z"
tags: []
categories: ["编程语言"]
slug: "cygwin-rails-on-ruby"
draft: false
lastmod: "2010-03-09T19:31:39Z"
id: 611478
url: "https://wikimo.iteye.com/blog/611478"
---

学习资源参见：[http://guides.rubyonrails.org/](http://guides.rubyonrails.org/)

找来找去感觉还是这个比较不错，虽然是英文的，不过基本上都能看懂的。

 

说几个学习中的注意点：

 

1.The bundled mysql.rb driver has been removed from Rails 2.2

 

解决方法：去http://github.com/tmtm/ruby-mysql 下载ruby-mysql安装，可能需要用到Git

可去http://code.google.com/p/tortoisegit/下载安装，使用方法和SVN类似，就是那个乌龟

 

2.连接mysql 的时候host 可能为127.0.0.1，同时cygwin下连的mysql数据库就是你本地windows下的数据库。

 

3.注意语句顺序，Java，JS这种可能无所谓，只要方法，属性存在就好。可是ralis未必，特地实验了下。

```
class PostsController < ApplicationController
  before_filter :find_post,
    :only => [:show, :edit, :update, :destroy]
  # ...
  def show
  # ...
  end

  def edit
  end

  def update
    # ...
  end

  def destroy
    # ...
  end

  private # 不能放在 before_filter下
    def find_post
      @post = Post.find(params[:id])
    end
end
```