Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Rei
@Rei
Admin
NO. 1 / 2011-10-28

[email protected]
深圳
182 Topics / 9130 Replies
727 Followers
0 Following
11 Favorites
中下水平 Rails 程序员
Reward
GitHub Public Repos
  • writings 940

    [Closed] Source code of writings.io

  • alipay 732

    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
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 服务器配置 at September 01, 2015

    反向代理。

  • 大学新生请问 Java 和 iOS 中优先学哪个好一点? at September 01, 2015

    挑有兴趣的学。

  • 关于 after_filter at September 01, 2015

    #1 楼 @48hour ensure 行了,不捕获。

  • 如何将网页标题也塞进缓存? at August 31, 2015

    不读数据库怎么找到 @page?

  • Sublime Text 2 和 TextMate 选择哪个入门开发 Rails 更好? at August 31, 2015

    DHH 用的是 TextMate。

    程序员编辑器都是要靠插件和配置的,不会 google 就哪个都难用。

  • 部署到服务器 asset 里的 css 和 js 时不时加载不上,内存不足么? at August 31, 2015

    #17 楼 @liguangsong 私有不看,邮件已删,建议改密码。

  • 部署到服务器 asset 里的 css 和 js 时不时加载不上,内存不足么? at August 31, 2015

    #13 楼 @liguangsong 把代码发到 github。

  • 3.times { say '《Ruby 元编程》第 2 版来了' } at August 31, 2015

    👍 Ruby 必读书。

  • 部署到服务器 asset 里的 css 和 js 时不时加载不上,内存不足么? at August 31, 2015

    不要靠猜,看浏览器调试,看静态服务器日志,看应用日志。

  • Rails 4-2-stable 参考手册 (Beta) at August 31, 2015

    #63 楼 @leekelby 本地生成可解决。

  • 请教一个 Linux 问题,如何将一个服务器完全隐藏起来? at August 29, 2015

    找提供私有网络的提供商,例如 https://www.digitalocean.com/company/blog/introducing-private-networking/

    自己做的话,就是不接入公网。

  • GitHub: Scaling on Ruby, with a nomadic tech team at August 28, 2015

    不过以前看过分享说 Github 用的语言也不少的,https://hubot.github.com/ 就是用 coffeescript。

  • 为什么都说 Devise 很慢? at August 27, 2015

    为什么说“为什么都说 Devise 很慢?”?

  • Turbolinks 遇上 多说 at August 26, 2015

    这段代码是在 head 插入 script 引入外部脚本然后立即执行,试试去掉这段代码,在 </body> 前插入

    <script src="//static.duoshuo.com/embed.js" async></script>
    
  • 支付宝 API 向导 (Ruby 版),以及开源一个支付宝 gem at August 25, 2015

    #56 楼 @osbron 顶楼的博客关了,新地址 http://chloerei.com/2013/08/01/alipay-payment-in-ruby/

  • 怎样只用 friendly_id,禁用主键 id at August 24, 2015

    #12 楼 @peter 情况越复杂,定制程度越高,改 gem 越麻烦。不过你用得爽我也不反对。

  • Ruby 方法的执行结果默认为 “最后一条语句的结果”*3 (重要的事情要说三遍!) at August 24, 2015

    标题很无聊。

  • gem install pg 遇到的问题 at August 24, 2015

    #8 楼 @drine 是怎么把 pg 装到那个位置的?

  • 怎样只用 friendly_id,禁用主键 id at August 24, 2015

    如果你说的是生成 url。

    def to_param
      "#{first_name}-#{last_name}"
    end
    
  • 怎样只用 friendly_id,禁用主键 id at August 24, 2015

    #8 楼 @peter 定义方法为什么要改 view 和 route?MVC 不就是为了解藕么。

  • 怎样只用 friendly_id,禁用主键 id at August 24, 2015

    定义一个方法不就好了。

    def find_by_friendly_id(id)
      first_name, last_name = id.split('-')
      find_by! first_name: first_name, last_name: last_name
    end
    
  • Rails 中如何实现登录次数尝试过多锁定十分钟 at August 24, 2015

    #15 楼 @jasonpu http://guides.ruby-china.org/caching_with_rails.html#activesupport::cache::memcachestore

  • Rails 中如何实现登录次数尝试过多锁定十分钟 at August 24, 2015

    #7 楼 @nowherekai 用 memcached 或 redis。

  • Rails 中如何实现登录次数尝试过多锁定十分钟 at August 24, 2015
    def show
      if Rails.cache.increment("login/ip/#{request.ip}",  0, expires_in: 10.minutes).to_i > 3
        render :ip_limit
      else
        # login form
      end
    end
    
    def create
      if Rails.cache.increment("login/ip/#{request.ip}", 1, expires_in: 10.minutes) > 3
        render :ip_limit
      else
        if success
          # login
          Rails.cache.delete("login/ip/#{request.ip}")
        else
          # render :show
        end
      end
    end
    

    补充:

    1. 基于 dalli(memcached)
    2. 读 increament 的值要用 increament 0 https://github.com/mperham/dalli/issues/463
  • Rails 中如何实现登录次数尝试过多锁定十分钟 at August 24, 2015

    #1 楼 @msg7086

    Rails 的精髓就是:能多用第三方组件的,绝对不要自己写。

    不赞成,看情况。

  • 如何提高 rails server 启动速度? at August 23, 2015

    https://docs.vagrantup.com/v2/synced-folders/nfs.html

  • 大家好,问一个 Ruby 的基础问题。 at August 22, 2015

    发代码不要用截图。

  • 请教更简洁的写法 at August 21, 2015
    class User
      has_many :memberships
      has_many :circles, through: :memberships do
        # Association Extensions
        def status(status)
          where(memberships: { status: status })
        end
      end
    end
    
    class Membership
      belongs_to :user
      belongs_to :circles
    end
    
    class Circle
      has_many :memberships
      has_many :users, through: :memberships
    end
    
    # Association
    User.first.circles.where(memberships: { status: status})
    # Association Extensions
    User.first.circles.status(status)
    
  • Prev
  • 1
  • 2
  • …
  • 79
  • 80
  • 81
  • 82
  • 83
  • …
  • 272
  • 273
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English