<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>猫言猫语 &#187; Rails</title>
	<atom:link href="http://www.wuwx.net/tags/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wuwx.net</link>
	<description>严以律己·宽以待人·自强不息·知行合一</description>
	<lastBuildDate>Mon, 19 Dec 2011 00:27:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<atom:link rel='hub' href='http://www.wuwx.net/?pushpress=hub'/>
<cloud domain='www.wuwx.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Rails表单中文件字段部分的设计</title>
		<link>http://www.wuwx.net/archives/5998</link>
		<comments>http://www.wuwx.net/archives/5998#comments</comments>
		<pubDate>Tue, 13 Sep 2011 09:34:09 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[uploaded_file]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/5998</guid>
		<description><![CDATA[&#60;%= f.fields_for :attachments do &#124;fields&#124; %&#62;&#160; &#60;%= fields.file_field :uploaded_file %&#62;&#60;% end %&#62;]]></description>
			<content:encoded><![CDATA[<blockquote><p>&lt;%= f.fields_for :attachments do |fields| %&gt;<br />&nbsp; &lt;%= fields.file_field :uploaded_file %&gt;<br />&lt;% end %&gt;</p>
</blockquote>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=5998" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/5998/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Signed and Permanent cookies in Rails 3</title>
		<link>http://www.wuwx.net/archives/5997</link>
		<comments>http://www.wuwx.net/archives/5997#comments</comments>
		<pubDate>Mon, 08 Aug 2011 00:44:17 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[开源技术]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[Permanent]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Signed]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/5997</guid>
		<description><![CDATA[David added a very cool feature to Rails recently – Signed cookies and permanent cookies This lets you set permanent and/or signed cookies very easily. Before this, you’d have to write : cookies[:user_preference] = { :value =&#62; @current_user.preferences, :expires =&#62; 20.years.from_now.utc } Now just becomes : cookies.permanent[:user_preference] = @current_user.preferences In case you happen to have [...]]]></description>
			<content:encoded><![CDATA[<p>David added a very cool feature to Rails recently – <a href="http://github.com/rails/rails/commit/0200e20f148c96afceeebc4da7b5985643f9f707">Signed cookies and permanent cookies</a> This lets you set permanent and/or signed cookies very easily.
<p>Before this, you’d have to write :</p>
<pre>cookies[:user_preference] = {
  :value =&gt; @current_user.preferences,
  :expires =&gt; 20.years.from_now.utc
}</pre>
<p>Now just becomes :</p>
<pre>cookies.permanent[:user_preference] = @current_user.preferences</pre>
<p>In case you happen to have seen my <a href="http://m.onkey.org/2009/10/18/railssummit-slides">Railssummit presentation</a> I had talked about using <a href="http://api.rubyonrails.org/classes/ActiveSupport/MessageVerifier.html">ActiveSupport::MessageVerifier</a> for implementing “Remember me” functionality. The above commit makes that a whole lot easier.</p>
<p>In your model <tt>User.rb</tt> :</p>
<pre># User.rb
def self.authenticated_with_token(id, stored_salt)
  u = find_by_id(user_id)
  u &amp;&amp; u.salt == stored_salt ? u : nil
end</pre>
<p>And when the user checks “Remember me” box, make sure the following gets run :</p>
<pre>cookies.permanent.signed[:remember_me] = [current_user.id, current_user.salt]</pre>
<p>This will set a permanent and signed cookie using the secret specified in <tt>ActionController::Base.cookie_verifier_secret</tt>. If you don’t have the <tt>cookie_verifier_secret</tt> defined, you might want to do that in one of the initializers.</p>
<p>Now when you want to login using the cookie :</p>
<pre>user = User.authenticated_with_token(*cookies.signed[:remember_me])</pre>
<p>In this specific case, it’s very important to use the <tt>salt</tt> in the cookie value. That makes sure the cookie gets invalidated if the user changes his password.</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=5997" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/5997/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.0: Beta release</title>
		<link>http://www.wuwx.net/archives/5890</link>
		<comments>http://www.wuwx.net/archives/5890#comments</comments>
		<pubDate>Sun, 07 Feb 2010 05:48:12 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[开源技术]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/5890</guid>
		<description><![CDATA[从Rails官方站点得知，Rails 3.0测试版已release]]></description>
			<content:encoded><![CDATA[<p>从Rails官方站点得知，Rails 3.0测试版已release</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=5890" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/5890/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ActiveRecord中遇到type字段的处理</title>
		<link>http://www.wuwx.net/archives/5794</link>
		<comments>http://www.wuwx.net/archives/5794#comments</comments>
		<pubDate>Wed, 24 Jun 2009 09:57:03 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[type]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/5794</guid>
		<description><![CDATA[　　ActiveRecord有一个功能，如果你的数据库中有一个字段名为“type”，在返回结果时，他将自动使用type字段中的值作为模型类的类名来实例化该结果，这样原始的模型就纯粹退化为DAO类了。 　　不过我有一个老应用，某个表中恰巧有一个“type”字段，里面又记录着一些奇怪的值，我又不能把这个字段改名，于是我就只能想办法让ActiveRecord把这个字段名给忽略掉了。 　　其实忽略的方法也挺容易的，写个：“set_inheritance_column nil”就可以了，放到真正的ActiveRecord代码中可能看起来会象这样： 　　 　　看起来挺简单的，不要要是找不着，真够你郁闷一阵子的。]]></description>
			<content:encoded><![CDATA[<p>　　ActiveRecord有一个功能，如果你的数据库中有一个字段名为“type”，在返回结果时，他将自动使用type字段中的值作为模型类的类名来实例化该结果，这样原始的模型就纯粹退化为DAO类了。</p>
<p>　　不过我有一个老应用，某个表中恰巧有一个“type”字段，里面又记录着一些奇怪的值，我又不能把这个字段改名，于是我就只能想办法让ActiveRecord把这个字段名给忽略掉了。</p>
<p>　　其实忽略的方法也挺容易的，写个：“set_inheritance_column nil”就可以了，放到真正的ActiveRecord代码中可能看起来会象这样：</p>
<p>　　<img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="50" alt="image" src="http://www.wuwx.net/wp-content/uploads/2009/06/image16.png" width="259" border="0"> </p>
<p>　　看起来挺简单的，不要要是找不着，真够你郁闷一阵子的。</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=5794" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/5794/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.3.0更改了ApplicationController类的文件名</title>
		<link>http://www.wuwx.net/archives/5675</link>
		<comments>http://www.wuwx.net/archives/5675#comments</comments>
		<pubDate>Sat, 22 Nov 2008 15:33:54 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[2.3]]></category>
		<category><![CDATA[ApplicationController]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/5675</guid>
		<description><![CDATA[　　ApplicationController是Rails中控制器的基类，在Rails 2.3.0之前，ApplicationController类保存于app/controllers/application.rb文件中，而在Rails 2.3.0中，这个类被保存于app/controllers/application_controller.rb这个文件中。 　　这样相对于application_helper.rb助手类，在命名风格上就更加统一了，如果你的Rails项目是使用Rails 2.3.0之前的版本生成的，当你将Rails库更新到Rails 2.3.0之后，就需要手动将app/controllers/application.rb手动更名为app/controllers/application_controller.rb。 　　如果不更改文件名的话，系统则会提示错误： uninitialized constant ApplicationController 　　DHH大神在CHANGELOG里是这么写的：* BACKWARDS INCOMPATIBLE: Renamed application.rb to application_controller.rb and removed all the special casing that was in place to support the former. You must do this rename in your own application when you upgrade to this version [DHH]]]></description>
			<content:encoded><![CDATA[<p>　　ApplicationController是Rails中控制器的基类，在Rails 2.3.0之前，ApplicationController类保存于app/controllers/application.rb文件中，而在Rails 2.3.0中，这个类被保存于app/controllers/application_controller.rb这个文件中。</p>
<p>　　这样相对于application_helper.rb助手类，在命名风格上就更加统一了，如果你的Rails项目是使用Rails 2.3.0之前的版本生成的，当你将Rails库更新到Rails 2.3.0之后，就需要手动将app/controllers/application.rb手动更名为app/controllers/application_controller.rb。</p>
<p>　　如果不更改文件名的话，系统则会提示错误：</p>
<p>uninitialized constant ApplicationController</p>
<p>　　DHH大神在CHANGELOG里是这么写的：* BACKWARDS INCOMPATIBLE: Renamed application.rb to application_controller.rb and removed all the special casing that was in place to support the former. You must do this rename in your own application when you upgrade to this version [DHH]</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=5675" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/5675/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails使我变的越来越痛苦</title>
		<link>http://www.wuwx.net/archives/5544</link>
		<comments>http://www.wuwx.net/archives/5544#comments</comments>
		<pubDate>Mon, 30 Jun 2008 01:35:39 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[心情随笔]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[哲学]]></category>
		<category><![CDATA[痛苦]]></category>
		<category><![CDATA[设计]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/5544</guid>
		<description><![CDATA[　　在我遇到Rails之前，我从来不会去关心程序的艺术性，也不会去考虑程序是否健壮，我的目的简单而单纯，只要他能按照我预期的方式执行就可以了。 　　在我遇到Rails之后，我为他的美所惊叹，原来框架可以被设计的这么美，他几乎完全符合我对程序的审美观，我开始坚信真的可以把一个工程当作成一件艺术品来做。 　　当我欣赏Rails的美妙，享受他带给我快感的同时，问题也随之而来了：匮乏的工程经验总是使我陷入过度设计之中，过于追求程序的艺术性使我在书写代码的时候唯唯诺诺。 　　或许，当你看惯了Rails，越来越习惯于他的美，也越来越趋同于他的哲学之后，你就会发现世界上太多太多不美的东西，有人说：完美主义者总是生活在痛苦之中。我非常同意这个观点，Rails正不断地影响我，使我在写代码的时候，总是想成为一个完美主义者，却因为代码中种种的不美妙，迟迟下不了手，给我带来了莫大的痛苦。 　　我是否应该把他放一段时间，尝试着努力接受一些自认为不那么美的设计，或许，自己就不那么痛苦了吧？]]></description>
			<content:encoded><![CDATA[<p>　　在我遇到Rails之前，我从来不会去关心程序的艺术性，也不会去考虑程序是否健壮，我的目的简单而单纯，只要他能按照我预期的方式执行就可以了。</p>
<p>　　在我遇到Rails之后，我为他的美所惊叹，原来框架可以被设计的这么美，他几乎完全符合我对程序的审美观，我开始坚信真的可以把一个工程当作成一件艺术品来做。</p>
<p>　　当我欣赏Rails的美妙，享受他带给我快感的同时，问题也随之而来了：匮乏的工程经验总是使我陷入过度设计之中，过于追求程序的艺术性使我在书写代码的时候唯唯诺诺。</p>
<p>　　或许，当你看惯了Rails，越来越习惯于他的美，也越来越趋同于他的哲学之后，你就会发现世界上太多太多不美的东西，有人说：完美主义者总是生活在痛苦之中。我非常同意这个观点，Rails正不断地影响我，使我在写代码的时候，总是想成为一个完美主义者，却因为代码中种种的不美妙，迟迟下不了手，给我带来了莫大的痛苦。</p>
<p>　　我是否应该把他放一段时间，尝试着努力接受一些自认为不那么美的设计，或许，自己就不那么痛苦了吧？</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=5544" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/5544/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>《应用Rails进行敏捷Web开发》第三版</title>
		<link>http://www.wuwx.net/archives/164</link>
		<comments>http://www.wuwx.net/archives/164#comments</comments>
		<pubDate>Fri, 25 Apr 2008 00:34:51 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[言语分享]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/164</guid>
		<description><![CDATA[　　Rails标准教程《应用Rails进行敏捷Web开发（Agile Web Development with Rails, 3rd Edition）》第三版已经出版，第一版他讨论的是Rails1.0的内容，到第二版中讨论则是Rails1.2的内容，而第三版中，他讨论的正是我们正在使用的Rails2.0。 　　此外，这本书的作者名单还增加了一位新作者，《RESTful Web Services》的作者Sam Ruby也加入到《应用Rails进行敏捷Web开发》第三版的撰写中，相信第三版一定会比第二版、第一版更加精彩，更加值得购买。 　　这本书目前可以在The Pragmatic Bookshelf上购买到，关注Rails的朋友可千万不要错过《应用Rails进行敏捷Web开发》第三版这本好书哦。]]></description>
			<content:encoded><![CDATA[<p>　　Rails标准教程《应用Rails进行敏捷Web开发（<a href="http://pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition" target="_blank">Agile Web Development with Rails, 3rd Edition</a>）》第三版已经出版，第一版他讨论的是Rails1.0的内容，到第二版中讨论则是Rails1.2的内容，而第三版中，他讨论的正是我们正在使用的Rails2.0。</p>
<p>　　此外，这本书的作者名单还增加了一位新作者，《RESTful Web Services》的作者Sam Ruby也加入到《应用Rails进行敏捷Web开发》第三版的撰写中，相信第三版一定会比第二版、第一版更加精彩，更加值得购买。</p>
<p>　　这本书目前可以在<a href="http://pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition" target="_blank">The Pragmatic Bookshelf</a>上购买到，关注Rails的朋友可千万不要错过《应用Rails进行敏捷Web开发》第三版这本好书哦。</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=164" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/164/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails官方网站因未知原因无法访问</title>
		<link>http://www.wuwx.net/archives/160</link>
		<comments>http://www.wuwx.net/archives/160#comments</comments>
		<pubDate>Mon, 21 Apr 2008 01:47:06 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[IT互联网]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/160</guid>
		<description><![CDATA[　　不知是黑客攻击原因，还是其他问题，今天早上Rails官方网站：http://www.rubyonrails.org无法正常访问，从国外访问Rails官方网站提示出现严重的500错误，从国内访问问题更严重，竟然将rubyonrails.org的域名劫持到一个广告页。 　　各地对rubyonrails.org的域名解析地址不一，乱套了。]]></description>
			<content:encoded><![CDATA[<p>　　不知是黑客攻击原因，还是其他问题，今天早上Rails官方网站：<a href="http://www.rubyonrails.org">http://www.rubyonrails.org</a>无法正常访问，从国外访问Rails官方网站提示出现严重的500错误，从国内访问问题更严重，竟然将rubyonrails.org的域名劫持到一个广告页。</p>
<p>　　各地对rubyonrails.org的域名解析地址不一，乱套了。</p>
<p><a href="http://www.wuwx.net/wp-content/uploads/2008/04/image12.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="188" alt="Rails" src="http://www.wuwx.net/wp-content/uploads/2008/04/image-thumb7.png" width="244" border="0"></a></p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=160" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/160/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使用Localization插件为Rails应用实现多语言支持</title>
		<link>http://www.wuwx.net/archives/80</link>
		<comments>http://www.wuwx.net/archives/80#comments</comments>
		<pubDate>Thu, 21 Feb 2008 04:56:29 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[开源技术]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/80</guid>
		<description><![CDATA[一、插件介绍 　　Localization是一个为Rails编写的插件，有点类似于gettext，使用很简单的方法就可以为你的应用实现多语言支持，进而实现应用的本地化。 二、插件安装 　　这个插件的安装方式与其他的Rails插件安装没啥太大区别，只需要在Rails项目目录中按照如下命令安装即可： ruby script\plugin install localization 三、插件使用 　　当Localization插件安装完成之后，Rails项目启动之后将自动载入他，我们需要在Rails项目目录中建立一个lang目录用来存放语言包。 　　推荐的做法是在lang目录下建立的语言包的文件名应该与语言名能够对应起来，例如我们要为这个项目建立一个中文语言包，我们就需要在RAILS_ROOT/lang/目录下建立一个名为zh_CN.rb的文件。内容如下： Localization.define&#40;'zh_CN'&#41; do &#124;l&#124; l.store 'Manage', '管理' l.store 'Users', '用户' end 　　然后在application.rb文件中加入如下内容，定义需要使用的语言名： Localization.lang = 'zh_CN' 　　再打开一个模板文件，在其中输入如下内容： &#60;%= link_to _&#40;&#34;Manage&#34;&#41;, admin_blogs_path %&#62; 　　启动Rails项目，浏览这个页面，看看是不是输出的是中文呢？]]></description>
			<content:encoded><![CDATA[<h3>一、插件介绍</h3>
<p>　　Localization是一个为Rails编写的插件，有点类似于gettext，使用很简单的方法就可以为你的应用实现多语言支持，进而实现应用的本地化。</p>
<h3>二、插件安装</h3>
<p>　　这个插件的安装方式与其他的Rails插件安装没啥太大区别，只需要在Rails项目目录中按照如下命令安装即可：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby script\plugin <span style="color: #c20cb9; font-weight: bold;">install</span> localization</pre></div></div>

<h3>三、插件使用</h3>
<p>　　当Localization插件安装完成之后，Rails项目启动之后将自动载入他，我们需要在Rails项目目录中建立一个lang目录用来存放语言包。<br />
　　推荐的做法是在lang目录下建立的语言包的文件名应该与语言名能够对应起来，例如我们要为这个项目建立一个中文语言包，我们就需要在RAILS_ROOT/lang/目录下建立一个名为zh_CN.rb的文件。内容如下：</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Localization.<span style="color:#9900CC;">define</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'zh_CN'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>l<span style="color:#006600; font-weight:bold;">|</span> 
  l.<span style="color:#9900CC;">store</span> <span style="color:#996600;">'Manage'</span>, <span style="color:#996600;">'管理'</span> 
  l.<span style="color:#9900CC;">store</span> <span style="color:#996600;">'Users'</span>, <span style="color:#996600;">'用户'</span> 
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>　　然后在application.rb文件中加入如下内容，定义需要使用的语言名：</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Localization.<span style="color:#9900CC;">lang</span> = <span style="color:#996600;">'zh_CN'</span></pre></div></div>

<p>　　再打开一个模板文件，在其中输入如下内容：</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to _<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Manage&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>, admin_blogs_path <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>　　启动Rails项目，浏览这个页面，看看是不是输出的是中文呢？</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=80" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/80/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows下Rails2.0.2最简安装教程</title>
		<link>http://www.wuwx.net/archives/69</link>
		<comments>http://www.wuwx.net/archives/69#comments</comments>
		<pubDate>Fri, 25 Jan 2008 14:48:26 +0000</pubDate>
		<dc:creator>有颜色的猫</dc:creator>
				<category><![CDATA[开源技术]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://www.wuwx.net/archives/69</guid>
		<description><![CDATA[　　Rails2.0.2的安装教程网上肯定有不少，不过我这个人比较懒，所以我的安装教程肯定有我自己的风格，啥风格？懒！ 一、下载ruby安装包 　　既然我比较懒，我必定会从http://www.ruby-lang.org/en/downloads这个地址下载Ruby 1.8.6 One-Click Installer，啥叫One-Click Installer？说白了，就是里面包含了很多ruby常用的包，比如rdoc，ri，gem等等，相信你也很懒，点我这个链接你就能把他下载下来。 　　 二、运行这个安装包 　　一个标准的Windows的exe包，运行之后就是一路下一步就可以了，没啥好讲的，不过ruby的安装路径可能需要根据你的个人喜好酌情修改一下，我个人喜欢把他装在E:\Program Files目录下，如图显示。 　　 三、使用gem安装rails 　　使用One-Click Installer就是好，装完了gem都直接带好了，我们就只管运行命令就好了，打开一个cmd窗口，直接执行gem  install rails一路Y，他会连接到官方站，然后根据依赖关系提示你安装其他几个包。 　　 四、安装sqlite3-ruby包 　　由于Rails2.0.2默认使用的数据库是sqlite数据库，所以我们需要给ruby装上sqlite3-ruby包，具体安装方式与rails类似。直接使用命令gem install sqlite3-ruby一键搞定。在这步的时候，他会让你选择安装哪个版本的sqlite3-ruby，我们选择新的mswin32那个版本就好了。 　　 五、下载sqlite库 　　虽然ruby的sqlite库已经有了，但是系统的sqlite库却还没有，因此我们还需要去sqlite官方去下载一个sqlite的dll库。 　　下载地址：http://www.sqlite.org/sqlitedll-3_5_4.zip 　　下载后，将其中的dll文件解压缩到你的ruby安装目录的bin目录下就可以了。 六、运行rails2.0.2 　　随便找个目录，使用rails demo命令为rails新建一个名为demo的项目，并在当前目录下新建一个demo目录，在目录里保存的就是我们的demo项目的代码。 　　再使用ruby demo\script\server来启动这个demo项目，之后用你的浏览器打开：http://localhost:3000 　　看看可爱的Rails2.0.2是不是呈现在你的眼前拉？ 　　 　　在安装过程中有任何疑问可以与我联系：QQ、MSN、Gmail：wuweixin@gmail.com，或者直接在我的Blog上留言都可以:)]]></description>
			<content:encoded><![CDATA[<p>　　Rails2.0.2的安装教程网上肯定有不少，不过我这个人比较懒，所以我的安装教程肯定有我自己的风格，啥风格？懒！</p>
<h3>一、下载ruby安装包</h3>
<p>　　既然我比较懒，我必定会从<a href="http://www.ruby-lang.org/en/downloads">http://www.ruby-lang.org/en/downloads</a>这个地址下载<a href="http://rubyforge.org/frs/download.php/29263/ruby186-26.exe">Ruby 1.8.6 One-Click Installer</a>，啥叫One-Click Installer？说白了，就是里面包含了很多ruby常用的包，比如rdoc，ri，gem等等，相信你也很懒，点我这个链接你就能把他下载下来。</p>
<p>　　<img src="http://www.wuwx.net/wp-content/uploads/2008/01/rails1.jpg" alt="rails1.jpg" /></p>
<h3>二、运行这个安装包</h3>
<p>　　一个标准的Windows的exe包，运行之后就是一路下一步就可以了，没啥好讲的，不过ruby的安装路径可能需要根据你的个人喜好酌情修改一下，我个人喜欢把他装在E:\Program Files目录下，如图显示。</p>
<p>　　<img src="http://www.wuwx.net/wp-content/uploads/2008/01/rails2.jpg" alt="rails2.jpg" /></p>
<h3>三、使用gem安装rails</h3>
<p>　　使用One-Click Installer就是好，装完了gem都直接带好了，我们就只管运行命令就好了，打开一个cmd窗口，直接执行gem  install rails一路Y，他会连接到官方站，然后根据依赖关系提示你安装其他几个包。</p>
<p>　　<img src="http://www.wuwx.net/wp-content/uploads/2008/01/rails3.jpg" alt="rails3.jpg" /></p>
<h3>四、安装sqlite3-ruby包</h3>
<p>　　由于Rails2.0.2默认使用的数据库是sqlite数据库，所以我们需要给ruby装上sqlite3-ruby包，具体安装方式与rails类似。直接使用命令gem install sqlite3-ruby一键搞定。在这步的时候，他会让你选择安装哪个版本的sqlite3-ruby，我们选择新的mswin32那个版本就好了。</p>
<p>　　<img src="http://www.wuwx.net/wp-content/uploads/2008/01/rails4.jpg" alt="rails4.jpg" /></p>
<h3>五、下载sqlite库</h3>
<p>　　虽然ruby的sqlite库已经有了，但是系统的sqlite库却还没有，因此我们还需要去sqlite官方去下载一个sqlite的dll库。</p>
<p>　　下载地址：<a href="http://www.sqlite.org/sqlitedll-3_5_4.zip">http://www.sqlite.org/sqlitedll-3_5_4.zip</a></p>
<p>　　下载后，将其中的dll文件解压缩到你的ruby安装目录的bin目录下就可以了。</p>
<h3>六、运行rails2.0.2</h3>
<p>　　随便找个目录，使用rails demo命令为rails新建一个名为demo的项目，并在当前目录下新建一个demo目录，在目录里保存的就是我们的demo项目的代码。</p>
<p>　　再使用ruby demo\script\server来启动这个demo项目，之后用你的浏览器打开：<a href="http://localhost:3000/">http://localhost:3000</a></p>
<p>　　看看可爱的Rails2.0.2是不是呈现在你的眼前拉？</p>
<p>　　<img src="http://www.wuwx.net/wp-content/uploads/2008/01/rails5.jpg" alt="rails5.jpg" /></p>
<p>　　在安装过程中有任何疑问可以与我联系：QQ、MSN、Gmail：<a href="mailto:wuweixin@gmail.com">wuweixin@gmail.com</a>，或者直接在我的Blog上留言都可以:)</p>
 <img src="http://www.wuwx.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=69" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.wuwx.net/archives/69/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

