本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

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




[Ruby on Rails]ActiveRecord 查询优化
软件技术

lhwork 发表于 2007/2/8 9:56:18

ActiveRecord使用很方便,只需要声明映射关系,就可以方便地获取各个关联对象,而且是延迟加载。有时候这种关系延迟加载可能会严重影响性能,比如下面这个例子:
ruby 代码 class User < ActiveRecord::Base    end     


  • 阅读全文(2042) | 回复(0) | 编辑 | 精华 | 删除
     


    [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


    阅读全文(3808) | 回复(0) | 编辑 | 精华 | 删除
     


    [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做点测试性应用,以确定是否值得迁移稍大点的项目到它上面。 首先建立一个项目:
    代码

    阅读全文(1756) | 回复(0) | 编辑 | 精华 | 删除
     


    [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文件:

    阅读全文(2419) | 回复(0) | 编辑 | 精华 | 删除
     


    [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

    阅读全文(2467) | 回复(0) | 编辑 | 精华 | 删除
     


    [Ruby on Rails]Basic User Authentication in Rails
    软件技术

    lhwork 发表于 2007/2/7 16:14:37

    This article walks through creating a basic authentication system in rails. Update: If you liked this article Digg it! The question of user authentication comes up regularly on the rails mailing list and there are several articles and discussions around the web on whether it should be part of the rails framework. Its not included in rails and it is
    阅读全文(2540) | 回复(0) | 编辑 | 精华 | 删除
     


    [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

    阅读全文(3201) | 回复(0) | 编辑 | 精华 | 删除
     


    [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

    阅读全文(2775) | 回复(0) | 编辑 | 精华 | 删除
     


    [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

    阅读全文(4316) | 回复(0) | 编辑 | 精华 | 删除
     


    [Ruby on Rails]Rmagick图形处理(不规则四边)
    软件技术

    lhwork 发表于 2007/2/7 15:21:11

    def self.showimg(len,imgname,content)  cur =

    阅读全文(1634) | 回复(0) | 编辑 | 精华 | 删除
     


    « 11 12 13 14 15 16 17 18 19 20 »



    站点首页 | 联系我们 | 博客注册 | 博客登陆

    Sponsored By W3CHINA
    W3CHINA Blog 0.8 Processed in 0.188 second(s), page refreshed 144756976 times.
    《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
    苏ICP备05006046号