Blog信息 |
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7577927 建立时间:2006年5月29日 |

| |
[Ruby on Rails]Rails项目防止表单重复提交 软件技术
lhwork 发表于 2007/2/8 9:48:05 |
类似struts的token,使用session保存token,调用check_token后就把session里的token清掉,所以不能重复调用。
因为有些界面可能会有多个表单,这些表单最好共用同一个token,不然提交过来的token很难验证,所以这里做了处理,不会多次生成。
ruby 代码
module ApplicationHelper
def token_field &n |
|
[Ruby on Rails]Rails 1.2 REST + Adobe Spry 软件技术
lhwork 发表于 2007/2/8 9:44:39 |
jerryinside介绍了一个adobe的ajax框架,和当初见到rails一样,我几乎是看它一眼就爱上了。它是一个轻量级的ajax框架,以XML作为协议,目前功能还比较单一,不过几乎完全就是我所期待的。
Rails生成XML轻而易举,Rails 1.2的REST也是一项另人心动的功能,而Spry也是以资源作为操作对象,这2者结合会发生什么?我试着学习Spry的内涵,并结合Rails做点测试性应用,以确定是否值得迁移稍大点的项目到它上面。
首先建立一个项目:
代码
|
|
[Ruby on Rails]使用ruby gettext实现RoR应用的多语言化——Step by Step 软件技术
lhwork 发表于 2007/2/7 17:30:01 |
0. 写本文时使用的环境: OS: MacOS X 10.4.7 Ruby 1.8.5 Rails 1.1.6 gettext 1.8.0
1. 安装ruby gettext 使用gem安装:
代码
gem install gettext
render_code();
gem会列出可以安装的gettext的版本。注意,如果是在Windows下安装的话,一定要选择后面带“(mswin32)”的选项,否则会有编译错误。
2. 修改config/environment.rb文件: 在 |
|
[Ruby on Rails]Configuring pound with lighttpd and mongrel. 软件技术
lhwork 发表于 2007/2/7 16:16:41 |
This article describes how to configure pound to use lighttpd to serve the static parts of your rails application and mongrel to serve your dynamic content.
I’ve tried several different deployment options for rails over the last few months. My preferred setup at the moment it to use pound as a reverse proxy/load balancer, proxying to lighttpd for static requests |
|
[Ruby on Rails]Adding a Rich Text Editor to your Rails Application 软件技术
lhwork 发表于 2007/2/7 16:09:39 |
Adding a rich text editor to your application enables users to markup their input text without having to know a markup syntax such as markdown or html. This page describes how to easily add this functionality to your rails application.
There are several free javascript rich text editors that can be incorporated into your application. These work by providing a javascript WYSIWYG interface that allows the user to generate the required html for each element that is enabled in the interfa |
|
[Ruby on Rails]Adding a Rich Text Editor to your Rails Application 软件技术
lhwork 发表于 2007/2/7 16:06:40 |
Adding a rich text editor to your application enables users to markup their input text without having to know a markup syntax such as markdown or html. This page describes how to easily add this functionality to your rails application.
There are several free javascript rich text editors that can be incorporated into your application. These work by providing a javascript WYSIWYG interface that allows the user to generate the required html for each element that is enabled in the interfa |
|
[Ruby on Rails]Rails migration简介 软件技术
lhwork 发表于 2007/2/7 15:22:36 |
(很久以前写的了,不过后来又发现个处理外键的扩展,更新一下。)
migration好像是rails 1.0出的功能,到底它是什么什么东东?用来干吗的?且听下面分解.
migration是一种分布环境下的数据库同步功能,它提供了: 1.独立于特定SQL的schema描述(当然是用ruby DSL啦).目前除了DB2外别的主流商用和开源数据库都被支持.(IBM真衰).显然,这种数据库独立的schema描述不可能包括数据库特定的细节, 所以在生产环境中需要再行调试优化. 2.schema和数据内容版本控制.我不是DBA啊(虽然曾经想过干这个),不知道有什么别的工具可以做数据库版本控制. 3.基于版本控制的分布式数据库同步.
先来说说基于ruby DSL的schema描述巴,打打基础. 如果rails项目中的数据库已经设计配置好了,可以执行rake db:schema:dump(这是Rails1 |
|
|