摘要: Gmail里的Ajax自动保存草稿在Rails里的实现 首先在layout里引入Javascript标签 [coce] <%= javascript_include_tag :defaults %> posts_controller.rb Java代码 defnewifrequest.get?@post=session[:post_draft]||Post.newelse@post=P... 阅读全文
posted @ 2009-07-02 11:52 麦飞 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 有时候我们可能要允许用户使用某些HTML标签,但是必须禁止另外一些HTML标签 我们可以在数据库存储用户输入的内容,包括允许的HTML标签,然后显示时过滤一下 让我们来一个helper方法来过滤内容,有两种方式: 1,写在application_helper.rb里 2,写在lib目录里,然后在config/environment.rb里加上require_dependency 'rails_pa... 阅读全文
posted @ 2009-07-02 11:26 麦飞 阅读(282) 评论(0) 推荐(0) 编辑
摘要: The following is a list of all of the methods public methods offered by the JavaScriptGenerator. These methods are called on the page object in your RJS templates.Since RJS is all about generating Jav... 阅读全文
posted @ 2009-07-02 10:57 麦飞 阅读(230) 评论(0) 推荐(0) 编辑