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
  • 安装 Rails 报错求助 at August 05, 2017

    错误信息贴全

  • 安装 Rails 报错求助 at August 05, 2017
    gem install nokogiri
    

    然后把错误信息贴全。

  • Ruby 模仿:|> at August 04, 2017

    一楼不是吗?

  • bcrypt 加密解密问题 at August 03, 2017

    bcrypt 是哈希不是加密,没有解密一说。

  • [深圳] DJI 大疆创新招聘 Ruby 工程师 7 名&电商实习生多名 (saberma 内推 15-40k)[福利更新] at August 03, 2017

  • [深圳] DJI 大疆创新招聘 Ruby 工程师 7 名&电商实习生多名 (saberma 内推 15-40k)[福利更新] at August 02, 2017

    快来快来,项目太多,人不够了。

  • 关于如何组织 coffee 文件 at August 02, 2017
    1. 如果要写页面特定的 js,可以用 <script></script> 内嵌在页面。
    2. 如果可以写成非侵入式,可以在 /assets/javascript 下新建任意一个 coffee 文件,默认都会被打包到 application.js 中。顶楼的路径是符合惯例的。
    3. 如果想要独立打包,独立引用,就要关掉默认的打包行为,然后设定独立的打包目标。你需要完整了解 Assets Pipeline 的行为 https://ruby-china.github.io/rails-guides/asset_pipeline.html
  • Ruby China 已迁移到新的服务器,基于 Docker 部署 at August 02, 2017

    没对外开放,说明需要小白鼠啊😃

  • Rails 5 中 Grape 如何实现在 development 环境重新加载 API 更改? at August 02, 2017

    建议不要在 Rails 上叠加 grape,不然处理各种兼容问题烦得要死。要不用 Rails 要不用 Grape。

  • Rails 5 中 Grape 如何实现在 development 环境重新加载 API 更改? at August 02, 2017

    greap 是啥?

  • Ruby China 已迁移到新的服务器,基于 Docker 部署 at August 02, 2017

    https://m.ucloud.cn/mobile/product/udocker.html

    我在学 kubernates,既然 ucloud 自己有一套可以先试试。

  • Ruby China 已迁移到新的服务器,基于 Docker 部署 at August 02, 2017

    可以用 UDocker,如果还用脚本管理不够容器 style。

  • 请教 Sidekiq 启动链接 redis 报密码错误 问题 at July 25, 2017

    把 password 写到 URL 里

  • [翻墙视频] Phoenix 1.3 的 Contexts - 虽然不是 Rails,但希望可以给你建设软件时带来点启发 at July 24, 2017

    🤦‍♂️

  • [翻墙视频] Phoenix 1.3 的 Contexts - 虽然不是 Rails,但希望可以给你建设软件时带来点启发 at July 24, 2017

    那么最近在折腾什么呢?

  • 我觉得 “头条” 栏目没有什么用 at July 24, 2017

    赞成

  • Rails 5.1.1 新特性 [添加新的加密的 secret] 示例 at July 24, 2017

    不打算使用。

  • 额,问个知道结果但不知道原因的问题,勿怪。。。 at July 24, 2017

    如果我维护这段代码第一反应会是我艹。这就是一段没有文档的 DSL,只有写的人觉得爽,后人没法维护。

  • [译] 关于 RSpec 的一点方法总结 at July 23, 2017

    Rspec 难写难读,读的时候要把每层 context 的 before 和 let 都看一遍,才知道 case 的上下文是什么。

    Minitest 是 plain Ruby,Ruby 的代码规范、重构方法、抽象逻辑都适用,懂得写好 Ruby 的也就懂得写好 Minitest。这也就是为什么 Rspec 的文章比 Minitest 多那么多,其实是 Rspec 里面乱七八糟的东西太多了。

  • [译] 关于 RSpec 的一点方法总结 at July 23, 2017

    Minitest 不推崇不必要的抽象。

  • HTTP 请求会被浏览器和服务器之外的其他地方缓存吗? at July 23, 2017

    It depends... https://tools.ietf.org/html/rfc7234

  • [译] 关于 RSpec 的一点方法总结 at July 23, 2017

    Rspec 可以让测试代码快速膨胀。

  • 额,问个知道结果但不知道原因的问题,勿怪。。。 at July 22, 2017

    可以,没什么问题。

  • Model 中 validates 的验证可以设置只在特定动作里执行吗? at July 22, 2017

    并不会,我贴下完整代码:

    # File activemodel/lib/active_model/secure_password.rb, line 53
    def has_secure_password(options = {})
      # Load bcrypt gem only when has_secure_password is used.
      # This is to avoid ActiveModel (and by extension the entire framework)
      # being dependent on a binary library.
      begin
        require "bcrypt"
      rescue LoadError
        $stderr.puts "You don't have bcrypt installed in your application. Please add it to your Gemfile and run bundle install"
        raise
      end
    
      include InstanceMethodsOnActivation
    
      if options.fetch(:validations, true)
        include ActiveModel::Validations
    
        # This ensures the model has a password by checking whether the password_digest
        # is present, so that this works with both new and existing records. However,
        # when there is an error, the message is added to the password attribute instead
        # so that the error message will make sense to the end-user.
        validate do |record|
          record.errors.add(:password, :blank) unless record.password_digest.present?
        end
    
        validates_length_of :password, maximum: ActiveModel::SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED
        validates_confirmation_of :password, allow_blank: true
      end
    end
    

    这一行:

    record.errors.add(:password, :blank) unless record.password_digest.present?
    

    如果 password_digest 不存在,就会报 password 为空,这样创建用户的时候校验通不过。

  • Model 中 validates 的验证可以设置只在特定动作里执行吗? at July 22, 2017

    源码:

    validates_confirmation_of :password, allow_blank: true
    

    如果 password 为空就不校验,所以你不要传 password 参数(去掉表单项)就行。

  • Ruby 作用域问题,应该如何访问域外的实例方法 at July 22, 2017

    你的问题可以简化为:

    class A
      def a_method
        "call from a"
      end
    end
    
    class B
      def b_method
        a_method
      end
    end
    

    B 定义在 A 里面和外面对于实例方法并没有什么不同——实例方法需要通过实例调用。

    想要用 B 调用 A 的方法,那么 new 一个实例:

    class B
      def b_method
        A.new.a_method
      end
    end
    
  • Ruby 作用域问题,应该如何访问域外的实例方法 at July 22, 2017

    奥,你定义了自己的 Ruby 语法。这个语法在 MRI 里不能执行,也许自己写一个解释器可以。

  • Ruby 作用域问题,应该如何访问域外的实例方法 at July 22, 2017

    你提问都说了“跨作用域”,跨作用域当然是不能访问拉。

  • Ruby 作用域问题,应该如何访问域外的实例方法 at July 22, 2017

    X-Y Problem http://coolshell.cn/articles/10804.html

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