Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Jerry Chen
@scriptfans
高级会员
第 1043 位会员 / 2012-02-15

昆明
8 篇帖子 / 120 条回帖
11 关注者
0 正在关注
12 收藏
未设置 GitHub 信息。
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Slimming-Controllers at 2017年04月11日

    https://github.com/hashrocket/decent_exposure

  • 从 Rails 中学习元编程的使用场景 at 2017年04月08日

    来讨论元编程吧 https://ruby-china.org/topics/32725 哈哈哈

  • 昆明程序员圈子聚会,PPT 分享 (Ruby 元编程探秘) at 2017年04月08日

    elixir 还在学,暂时分享不出干货,囧

  • 昆明程序员圈子聚会,PPT 分享 (Ruby 元编程探秘) at 2017年04月08日

    本地环境不太好

  • 昆明程序员圈子聚会,PPT 分享 (Ruby 元编程探秘) at 2017年04月08日

    @yunshang 有,大熊猫级别

  • 《Ruby 元编程》《Ruby 原理剖析》的姊妹篇《优雅的 Ruby》上天猫了 at 2017年03月28日

    Avdi 可是偶像级人物,他写的每一本书我都买了仔细学习,这下有中文的更要收一本了。

  • 送几本《RESTful Rails Development (中文版)》 at 2017年03月04日

    这本书,怎么说呢,看过英文版,觉得很一般……

  • 理解 Rails 5 中 Controller 和 Integration 测试 at 2016年08月15日

    另外关于从 action 名称改成 url,那真是很蛋疼的事儿,写 users_path 是不是比:create 更浪费击键次数?很明显嘛……

  • 理解 Rails 5 中 Controller 和 Integration 测试 at 2016年08月15日

    controller 测试还是有必要的,虽然现在被抽出来了,但我个人肯定是要自己加回来的(还好 rspec-raills 没学坏)。比方说测试 application 级别的 filter,更合适利用 controller 测试来做,别忘了 ActionController::TestCase 有个叫做 controller 的方法可以让你在测试代码中模拟派生控制器:

    RSpec.describe Api::ApplicationController, type: :controller do
      controller do
        skip_before_action :authenticate, only: [:new]
    
        def index;end
        def new;end
      end
    
      #......
    
      context '未提供Token,认证失败' do
        before do
          get :index, format: 'json'
        end
    
        it '返回401状态码' do
          expect(response).to have_http_status 401
        end
    
        it '返回正确的响应头' do
          expect(response.header).to have_key 'WWW-Authenticate'
        end
      end
    
      #......
    end
    

    恩,你是可以针对某个具体的子类来测试,但我想说,如果严格按照 TDD 的流程来做,这个时候你是还没走到子类控制器那一步的好不好……

    关于 Rails 测试,或许闲下来我会写个系列探讨下。

  • 分享一门新语言 Crystal,Ruby 的语法,C 的速度 at 2016年08月10日

    #37 楼 @yukihiro_matz 赶紧滚回去开发 mruby 吧,等着用呢😜

  • 分享一门新语言 Crystal,Ruby 的语法,C 的速度 at 2016年08月09日

    Crystal 的静态类型决定了很多 Ruby 的元编程奇技淫巧无法实现,而且两者语法太过类似,没有新鲜感,不如直接上 Elixir 了。

  • [上海] 寻找有工匠精神的大牛加入技术强队 - Ruby - Rails at 2016年05月13日
    def accept_remote?
      #TODO
    end
    
  • Agile Web Development with Rails 5 引进事宜 at 2016年05月09日

    #21 楼 @rocLv Rebuilding Rails 这本,现在定了哪家出版社么?如果没人愿意,不如考虑放 leanpub 自出版得了。

  • 现在有国内出版社引进《The Rails4 Way》吗 at 2016年04月14日

    这本书肯定会出新版本的,说实话,称得上 rails 圣经了。

  • Agile Web Development with Rails 5 引进事宜 at 2016年04月14日

    这本书前几个版本已经跟不上时代了,远不如你之前翻译的 rails tut,很多年前的评价: https://book.douban.com/review/4654745/

  • Rails- 让我欢喜让我忧! at 2016年04月14日

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

  • 前端不用现成框架的情况下, 前端表单校验有什么好的插件呢? at 2015年11月27日

    parsleyjs

  • 3.times { say '《Ruby 元编程》第 2 版来了' } at 2015年09月06日

    #32 楼 @eiyamaya 《Rails 4 Test Prescriptions: Build a Healthy Codebase》 http://www.amazon.com/Rails-Test-Prescriptions-Healthy-Codebase/dp/1941222196/

  • 3.times { say '《Ruby 元编程》第 2 版来了' } at 2015年09月05日

    原版已撸……

  • Rails 的 includes 预加载的实际调用 at 2015年08月18日

    #8 楼 @391117134 sorry,忘记加 where 了 has_many :popular_posts, -> {where 'like_count > 100'}, class_name: 'Post' 这个才对:)

  • Rails 的 includes 预加载的实际调用 at 2015年08月18日

    关于 结合使用 association 来实现预加载 这一节的描述,语法已经过时了,目前的 rails 版本是不认 condition 的,直接使用 lambda 作为第二个参数即可: has_many :popular_posts, -> {like_count > 100}, class_name: 'Post'

  • 启动 Nginx 成功,但是 deploy 的应用 500 Internal Server Error at 2015年08月09日

    #6 楼 @arc_start 还有就是,部署到生产环境,你是需要预编译资源文件的……

  • 启动 Nginx 成功,但是 deploy 的应用 500 Internal Server Error at 2015年08月09日

    #6 楼 @arc_start 你可以随便设置的,看看 nginx 的文档就行了。主要是这句:location ~* ^/assets/

  • 启动 Nginx 成功,但是 deploy 的应用 500 Internal Server Error at 2015年08月09日

    assets 的问题,也需要在 nginx 的配置文件里面指定一下你需要 serve 的文件目录:

    location ~* ^/assets/ {
        # Per RFC2616 - 1 year maximum expiry
        expires 1y;
        add_header Cache-Control public;
    
        # Some browsers still send conditional-GET requests if there's a
        # Last-Modified header or an ETag header even if they haven't
        # reached the expiry date sent in the Expires header.
        add_header Last-Modified "";
        add_header ETag "";
        break;
      }
    
    
  • 启动 Nginx 成功,但是 deploy 的应用 500 Internal Server Error at 2015年08月09日

    或许你忘记配置 secret.yml 咯……

  • 为什么很少见有使用 DRuby 开发分布式应用的? at 2015年07月09日

    自己的小玩意儿项目中用了……

  • Rails 项目里的三大毒瘤 at 2015年06月25日

    哈哈,想看元编程的实际用途?改天写一篇给你们咯…… Just for fun :)

  • 淘宝的 RubyGems 镜像是出问题了么? at 2015年06月10日

    #1 楼 @beyondyuqifeng 那就不是特例了,是 gfw 的问题吗? @huacnlee

  • 元编程中的环绕别名 (around Alias) 使用场景是什么? at 2015年06月10日

    在没有 Module.prepend 之前,如果你要使用 monkey pacth 去修改或扩充现有方法的逻辑的话,只能采用 alias,否则就必须借助派生子类来干这个事情……

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