Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Rei
@Rei
管理员
第 1 位会员 / 2011-10-28

[email protected]
深圳
182 篇帖子 / 9135 条回帖
727 关注者
0 正在关注
11 收藏
中下水平 Rails 程序员
打赏作者
GitHub Public Repos
  • writings 940

    [Closed] Source code of writings.io

  • alipay 731

    Unofficial alipay ruby gem

  • code_campo 291

    [Closed] Source code of http://codecampo.com

  • asciidoctor-pdf-cjk-ka... 101

    **no longer maintained**

  • asciidoctor-htmlbook 31

    Asciidoctor HTMLBook is an Asciidoctor backend for converting AsciiDoc documents to HTMLBook docu...

  • material-ui 17

  • rich-text-editor 12

  • htmlrenderer 12

  • rails-chatgpt-demo 8

  • rails-app 7

    A Rails project template lets me start new projects quickly.

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Rails sanitize allowed_attributes 不安全 at 2016年01月18日

    #3 楼 @quakewang 我觉得把这段

    def scrub_attributes(node)
      if @attributes
        node.attribute_nodes.each do |attr|
          attr.remove if scrub_attribute?(attr.name)
        end
    
        scrub_css_attribute(node)
      else
        Loofah::HTML5::Scrub.scrub_attributes(node)
      end
    end
    

    改成这样就好了:

    def scrub_attributes(node)
      if @attributes
        node.attribute_nodes.each do |attr|
          attr.remove if scrub_attribute?(attr.name)
        end
      end
      Loofah::HTML5::Scrub.scrub_attributes(node)
    end
    

    Loofah::HTML5::Scrub 里面还有不少规则,也不知道以后会再加什么规则,全部继承才能利用到。

    然后看了 sanitize,觉得这个 gem 规则设置要容易一些。

  • 关于 Gem 的几个问题 at 2016年01月18日

    自己写~ 😄

    其实 Rails 就是最大公约数了,业务部分都是各有不同应该自己写。

  • 别用 raw 和 html_safe at 2016年01月17日

    #3 楼 @jasl WoW,我现在才理解你说的内容。 👍

  • Rails sqlite3 时间显示 at 2016年01月15日

    刚好看到个漫画 http://www.commitstrip.com/en/2016/01/14/a-story-about-timestamp-and-timezone/

  • [找到答案,bundle] Ruby 有想 Python 的 virtualenv 工具吗? at 2016年01月13日

    据我了解 Python 的 virtualenv 对应的是 Ruby 的 bundler http://bundler.io/ 。

    rvm get head
    

    就有 2.3 了。

  • [成都活动] 比特币热潮下——开发者的机遇与挑战 at 2016年01月13日

    不要重复发帖。

  • 发现一个很有意思的写法 at 2016年01月13日

    有个缺点是用不到 multi fetch cache 优化了。

  • 发现一个很有意思的写法 at 2016年01月13日

    这样可以少一层 block,这是什么项目里看到的?

  • 求大神指点 ruby 安装在 windows 上的相关问题 at 2016年01月13日

    这是网络问题,翻墙。

  • 当 ransack 遇到英文下划线该怎么解决? at 2016年01月11日

    又被 @ 了,这个问题非要管理员才能回答?不要把问题标记为“紧急”,即使对你而言的确如此。

  • 学生工作室后台想从 Java 转 Ruby at 2016年01月11日
    1. 自己不熟悉 Rails,让工作室转技术栈的理由不充分。
    2. 学自己想学的,不要帮别人选择。
  • 偶然发现 Rails model validates 和 rake:migrate 发生了结合改变 ? at 2016年01月11日

    #2 楼 @yuanrenkai 正常,延迟载入。

  • 偶然发现 Rails model validates 和 rake:migrate 发生了结合改变 ? at 2016年01月11日

    save(validate: false) http://guides.ruby-china.org/active_record_validations.html#%E8%B7%B3%E8%BF%87%E9%AA%8C%E8%AF%81

    但这会引入脏数据。

  • 为何使用了 Turbolinks 以后,jquery_ujs 里的 Event 被重复 bind 了多次? at 2016年01月11日

    果然

    <html>
      <head>
        <nav>nav</nav>
        <script></script>
      </head>
      <body>
      </body>
    </html>
    

    浏览器修正

    可显示元素要放 body 里。

  • 为何使用了 Turbolinks 以后,jquery_ujs 里的 Event 被重复 bind 了多次? at 2016年01月11日

    把 head 里面那段 nav 删掉看看,我怀疑是不合语法浏览器自动修正把 script tag 归入 body 了。

  • Can't verify CSRF token authenticity 看了社区之前同样问题依然没有解决. at 2016年01月11日

    预装的 jquery_ujs 已经处理了 csrf token,有问题应该是你添加或删除了不必要的东西。

  • Can't verify CSRF token authenticity 看了社区之前同样问题依然没有解决. at 2016年01月11日

    layout 里面有 csrf_meta_tags 吗?

  • 为何使用了 Turbolinks 以后,jquery_ujs 里的 Event 被重复 bind 了多次? at 2016年01月11日

    app/asserts/javascripts 目录还有什么文件?

    将 application.js 删到剩下:

    //= require jquery
    //= require jquery_ujs
    //= require turbolinks
    

    再试试。

  • carrierwave 多态 has_many nested 关联,取不到 attach at 2016年01月11日

    accepts_nested_attributes_for

    http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html https://robots.thoughtbot.com/accepts-nested-attributes-for-with-has-many-through

  • 为何使用了 Turbolinks 以后,jquery_ujs 里的 Event 被重复 bind 了多次? at 2016年01月10日

    贴代码。

  • 生产环境下 module 的问题 at 2016年01月10日

    #4 楼 @yqwoe 写在哪里,放在哪里?

  • 生产环境下 module 的问题 at 2016年01月10日

    怎么 include 的?

  • 使用 Ruby 的单元测试,如何使异常抛出 at 2016年01月10日

    MinitTest 捕获异常之后也会打印调用栈,所以这是别的问题。

  • ruby-china 源码中 class AccountController < Devise::RegistrationsController 是如何生成的? at 2016年01月10日

    http://lmgtfy.com/?q=Devise%3A%3ARegistrationsController

  • will_paginate 分页过多 (大概 10000 页),点击最后几页的时候,速度明显变慢 at 2016年01月08日

    #15 楼 @easonlovewan 一般来说用户要的是搜索和过滤。

  • will_paginate 分页过多 (大概 10000 页),点击最后几页的时候,速度明显变慢 at 2016年01月08日

    #12 楼 @easonlovewan 页数大于某个值就直接返回空。

  • 我昨天发的关于如何让异常抛出的帖子怎么被删除了 at 2016年01月08日

    @huacnlee

  • will_paginate 分页过多 (大概 10000 页),点击最后几页的时候,速度明显变慢 at 2016年01月08日

    不给查太大。

  • 上一页
  • 1
  • 2
  • …
  • 67
  • 68
  • 69
  • 70
  • 71
  • …
  • 273
  • 274
  • 下一页
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English