Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
saiga
@saiga
Member
NO. 4375 / 2012-11-05

[email protected]
深圳
19 Topics / 701 Replies
14 Followers
1 Following
63 Favorites
请认准唯一指定邮箱:aiasfina#hotmail.com
GitHub Public Repos
More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • Atom Editor 有 deb 包了 at October 14, 2014

    直接用 ppa 装 😃

    https://launchpad.net/~webupd8team/+archive/ubuntu/atom

  • product ? product.title : "-" 能不能更简洁 at October 14, 2014
    product.try(:title) || '-'
    
  • 自制的 hexo 皮肤 Vanilla Cream at October 12, 2014

    字体没必要调大,会很难看的。建议先把衬线字改了,加上文泉驿微米黑和微软雅黑 font-family: 'Open Sans', 'WenQuanYi Micro Hei', 'Microsoft YaHei', sans-serif;

  • 如何排序 ActiveRecord::Relation at October 12, 2014

    #5 楼 @anklos rails 已经做了 get/set,你再加上 attr_accessor,别人会以为 name 是虚拟属性...

    一次更新 N 张表都是常有的事,两张表就别嫌麻烦啦

  • 如何排序 ActiveRecord::Relation at October 12, 2014

    attr_accessor :name 这是啥?

  • 如何排序 ActiveRecord::Relation at October 12, 2014

    #2 楼 @anklos 你应该是问了两个问题吧。抱歉我没看到第二个...

  • 如何排序 ActiveRecord::Relation at October 12, 2014

    post 加 comments_count

  • [广州] CitySpade - 票集网络科技有限公司招工程师! at October 12, 2014

    要兼顾运维啊...每次动服务器都心惊胆战的 😢

  • 自制的 hexo 皮肤 Vanilla Cream at October 12, 2014

    #2 楼 @leopku 密密麻麻看着不舒服,改成这样感觉好点

  • 自制的 hexo 皮肤 Vanilla Cream at October 12, 2014

    右上角吓尿了..

  • 如何添加一个 Cookie 使用协议 at October 10, 2014

    你给的那个网站的实现...

    $(document).ready(function () {
        if ($.cookie("cookieLaw") == null) {
            if ($("#popups").length == 0)
                $("body").prepend("<div id='popups'></div>");
            $("#popups").append('<div id="cookieLaw"><a id="cookieClose">×</a>We use cookies to enhance your experience on our website. By continuing to use our website, you are agreeing to our use of cookies. You can change your cookie settings at any time. <a class="cookieClosing"> Continue </a> or <a href="http://global.oup.com/cookiepolicy/?siteid=freeodo" target="_blank" title="How we use cookies on this site">Find out more</a></div>');
            $.cookie("cookieLaw", true, {path : "/", expires : 365});
            $(".cookieClosing, #cookieClose").click(function () {
                $("#cookieLaw").hide();
            });
        }
    });
    
  • Mac 下 bundle 安装 ‘charlock_holmes’ 各种失败,求指导 at October 10, 2014

    试试升级一下 icu,顺便检查一下 /usr/local/opt/icu4c

    brew update
    brew install icu4c --HEAD
    
  • Mac 下 bundle 安装 ‘charlock_holmes’ 各种失败,求指导 at October 10, 2014

    太久远了,我都忘光了...

    README 看看:https://github.com/brianmario/charlock_holmes#homebrew

  • 大家在前期设计时都使用什么工具 at October 10, 2014

    团队用白板,自己不用..

  • 请教 ActiveRecord 动态注入属性的问题 at October 09, 2014

    #3 楼 @wikimo 这个建议在 json builder 里面处理,比如 rabl 或 jbuilder

  • 请教 ActiveRecord 动态注入属性的问题 at October 09, 2014

    根据你的需求,我建议重写 inspect 方法...

    # Returns the contents of the record as a nicely formatted string.
    def inspect
      # We check defined?(@attributes) not to issue warnings if the object is
      # allocated but not initialized.
      inspection = if defined?(@attributes) && @attributes
                     self.class.column_names.collect { |name|
                       if has_attribute?(name)
                         "#{name}: #{attribute_for_inspect(name)}"
                       end
                     }.compact.join(", ")
                   else
                     "not initialized"
                   end
      "#<#{self.class} #{inspection}>"
    end
    
  • 问问大家用富文本时有没有碰到过这个问题 at October 09, 2014

    turbolinks.. 给入口链接加上 data-no-turbolinks 跳过就可以了

  • 求推荐比较好的学习设计,还有设计素材类的网站 at October 06, 2014

    Dribbble, Behance

  • 分页查询效率问题的疑问 at October 06, 2014

    要了解具体实现可以翻翻 ActiveRecord::Querying ,ActiveRecord::Relation 和 ActiveRecord::FinderMethods 这三个模块的代码。 另外推荐 pat 写的那篇 20000 leagues under ActiveRecord

  • 分页查询效率问题的疑问 at October 06, 2014

    where 方法会产生一个新的 ActiveRecord::Relation 对象实例,多个 where 方法串联只会产生一堆中间对象,最后再交给 arel 生成 sql 比如

    @articles1 = Article.where(category: 'foo') #=> ActiveRecord::Relation#{where_values={category: 'foo'}}
    @articles2 = @articles1.where(title: 'bar') #=> ActiveRecord::Relation#{where_values={category: 'foo'. title: 'bar'}}
    @articles2.to_a #=> generate sql...
    
  • 对 Rails 中「缓存失效」的一点疑惑 at October 04, 2014

    缓存失效即使是人为控制都非常麻烦,这个程序帮不了... expire_cache 在 rails4 基本没用,因为 4 默认给每个 key 加入了 digest

    只要定义了 cache_key,资源更新时,Rails 会使缓存区里的缓存自动过期。

    这个说法是正确的,只不过自动过期并不是把缓存数据删除,而是不再命中该缓存,过期的缓存还是继续存在的,所以基于 file 的缓存方案会产生许多重复的垃圾,dhh 推荐使用 memcache 就是把删除缓存的操作交给 memcache 来做。

  • 关于 SQL 注入的问题 at September 28, 2014

    #10 楼 @yijunlin 其实我说结束的查询是“用户期望查询” 😢

    我是把 SELECT * FROM projects WHERE name = ' ' OR 1 这个布尔表达式拆成了一个查询表达式和一个常量式,所谓的提前结束是期望查询在第一个表达式完成了,程序返回了第二个非期望表达式..

    结果好像越描越糊涂了..

  • 下面这个是什么字体? at September 28, 2014

    Sutro Deluxe Primary 非免费字体,30 刀

  • [已解决] 无限分类的展示 at September 27, 2014

    你用的是 modified preorder tree traversal algorithm? 只要根据左右值区间,左节点排序作深度优先遍历就好了。渲染的话还要在 helper 里面递归一遍...

  • ruby 模块中的::前缀表示什么 at September 27, 2014

    https://ruby-china.org/topics/21337

  • Prev
  • 1
  • 2
  • …
  • 5
  • 6
  • 7
  • 8
  • 9
  • …
  • 22
  • 23
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English