Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
jgm
@kayakjiang
高级会员
第 314 位会员 / 2011-11-29

13 篇帖子 / 259 条回帖
62 关注者
0 正在关注
232 收藏
技多不压身
GitHub Public Repos
  • mybt_coin 38

    高仿比特币, 目的是帮助人们在本地环境轻松并且完整地验证区块链技术的核心概念和核心算法

  • weui-base-guide-practice 20

    对微信设计指南中的Web设计和小程序基础控件库的练习

  • mongo_image_demo 3

    build a image server using mongodb

  • baya.github.io 2

    舠

  • block7days 2

  • activeadmin_debug 1

  • bluedoc 1

    An open-source document management tool for enterprise self host.

  • blog-1 1

    煎鱼的博客,有点忙。

  • audit-log 1

    📑 Create audit logs into the database for user behaviors, including a web UI to query logs.

  • bitcoin 1

    Bitcoin Core integration/staging tree

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 使用 Rails 5 创建 API-Only 应用 at 2016年07月25日

    #9 楼 @smartepsh 你自己弄下嘛

  • 挽救你的 Git 仓库 at 2016年07月25日

    前端小妹立了一功,代我谢谢她😂

  • 使用 Rails 构建 API 实践 at 2016年07月22日

    #183 楼 @smartepsh 在浏览器访问应该不用添加转义符,如果是用 curl 在 shell 中访问可能会出现这种情况

  • 使用 Rails 构建 API 实践 at 2016年07月22日

    #181 楼 @smartepsh 你自己多试下,检查下 & 是否正确。

  • 基于 Ruby 实现的移动 App 自动化测试框架 at 2016年07月21日

    专业

  • Teahour 以太坊专访 at 2016年07月13日

    这个是怎么转换成文字的?人肉还是机器?

  • 怎么 review 一个硕大的 Pull Request 或者 Merge Request at 2016年06月23日

    looks fine, 这个场面似曾相识哈哈

  • 围绕 MacBook Pro 打造的工作站设计日志 at 2016年06月23日

    还是做后端好啊,一台三年没有升级的 mac book 就搞掂了一切

  • 不会写前端感觉太痛苦了 at 2016年06月18日

    前端博大精深,不会写正常,不必太痛苦😂

  • 系统升级后的后遗症 at 2016年06月18日

    我的 mac book 有 3 年没有升级系统,半年没有关机了,对付平时的工作没有问题。

  • 使用 Rails 构建 API 实践 at 2016年06月18日

    #176 楼 @ecloud , 不会出现这种情况吧,我怎么没有遇到过,

    class User < ActiveRecord::Base
    
      has_secure_password
    
      has_many :microposts
    
      before_create :generate_authentication_token
    
      def generate_authentication_token
        loop do
          self.authentication_token = SecureRandom.base64(64)
          break if !User.find_by(authentication_token: authentication_token)
        end
      end
    
      def reset_auth_token!
        generate_authentication_token
        save
      end
    
    end
    

    按道理 before_create 只会对 create 方法起作用,update_attributes 应该不会触发 generate_authentication_token.

    要不你试着将 before_create :generate_authentication_token 注释掉,然后创建 user 后,执行 user.generate_authentication_token

    或者改下 generate_authentication_token 方法

    def generate_authentication_token(force=false)
      # 如果强制或者 authentication_token 是空的则生成 authentication_token
       if force || authentication_token.blank?
        loop do
          self.authentication_token = SecureRandom.base64(64)
          break if !User.find_by(authentication_token: authentication_token)
        end
       end
      end
    
  • [网站访问问题][已解决] 到底什么影响一个网站的访问速度呢? at 2016年06月08日

    一堆的 404 不慢才怪,有没有用 sprokect? 贴下你的 assets/javascrits/application.js 文件

  • Shell 备份目录问题 at 2016年06月06日

    你应该用 cap 部署

  • 使用 Rails 构建 API 实践 at 2016年06月02日

    #174 楼 @sunnyhust2005 如果去掉.json 后缀,相应的你每次请求时需要增加一个 format=json 的参数

  • Ruby SH 薄荷聚会有感 at 2016年05月23日

    Ruby 其实是一门年轻的老语言,虽然 Ruby 诞生于 1993 年,但是 Ruby 在世界范围内被人熟知大概是 2006 年 Rails 获得 Jolt Award,在 2006 年 Rails 开始火起来时 ( github, twitter 等一批知名的网站就是在那段时间内用 Rails 开发出来的),Ruby 才开始被人们熟知,也就是说从 93 年到 2006 年,整整 13 年时间 Ruby 默默无闻,相当长一段时间没有人知道有这样一个语言存在,这可能是造成 Ruby 的应用领域比较狭窄的一个原因,为什么 Ruby 会有这么长的一段沉寂期,这应该是其他原因造成的,而不是 Ruby 自身的原因,总之是金子总会发光,Ruby 以后会不会在其他领域爆发这个还真说不定。另外说一句,我最开始玩 Ruby 不是用 Rails 做 web 开发,而是为一个叫 RPG Maker 的游戏框架写 Ruby 脚本玩。

  • [北京 / 武汉 / 远程] 石墨文档 做最美产品 - 寻找中国最有才华的工程师、设计师和产品经理加入 at 2016年05月21日

    买过一本 @luin 写的 redis 入门指南,很不错的书。

  • [写给一些还不知道的 PG 们] Array#dig, Hash#dig, OpenStruct#dig, New features in ruby 2.3 at 2016年05月13日

    已加入肯德基豪华午餐

  • [上海] 寻找有工匠精神的大牛加入技术强队 - Ruby - Rails at 2016年05月13日

    number_of_cute_girls: 1000, 这个是二进制 1000 个?

  • 使用 Rails 构建 API 实践 at 2016年04月14日

    #155 楼 @xiao1994 我能说的都能通过 google 找到,数据库一般用 mysql 或者 postgresql, 部署一般是 nginx+passenger+cap

  • 使用 Rails 构建 API 实践 at 2016年04月10日

    #150 楼 @ecloud 是的,

    gem 'bcrypt', '~> 3.1.7'
    
    # Schema: User(name:string, password_digest:string)
    class User < ActiveRecord::Base
      has_secure_password
    end
    
    user = User.new(name: 'david', password: '', password_confirmation: 'nomatch')
    user.save                                                       # => false, password required
    user.password = 'mUc3m00RsqyRe'
    user.save                                                       # => false, confirmation doesn't match
    user.password_confirmation = 'mUc3m00RsqyRe'
    user.save                                                       # => true
    user.authenticate('notright')                                   # => false
    user.authenticate('mUc3m00RsqyRe')                              # => user
    User.find_by(name: 'david').try(:authenticate, 'notright')      # => false
    User.find_by(name: 'david').try(:authenticate, 'mUc3m00RsqyRe') # => user
    
  • 使用 Rails 构建 API 实践 at 2016年04月01日

    #146 楼 @xiao1994 不错,自己爬出坑了

  • 使用 Rails 构建 API 实践 at 2016年03月31日

    #143 楼 @xiao1994 ,你给的信息没有什么用,你先把 log/development.log 删除,然后 curl -i http://localhost:3000/api/v1/users/1.json, 注意不要做其他请求,最后把 development.log 的内容贴过来

  • 使用 Rails 构建 API 实践 at 2016年03月31日

    #139 楼 @xiao1994 , 把异常日志贴出来,可以通过 tail -100f log/development.log 查看日志

  • [北京][持续招聘呀.....] (玎少说,只要你敢来,我们就敢留) 来自新一代数据分析产品 GrowingIO 对 Ruby 工程师的邀请 (20K - 40K) at 2016年03月30日

    留膝

  • 使用 Rails 构建 API 实践 at 2016年03月30日

    #137 楼 @xiao1994 用浏览器访问的话,在 url 后面加 .json, 比如:

    /api/v1/users/1.json
    

    别贴图,直接贴异常信息。

  • 使用 Rails 构建 API 实践 at 2016年03月28日

    #133 楼 @ecloud 如果你是用浏览器访问,需要加上 .json 的后缀, http://localhost:3000/api/v1/users/1.json

  • [北京] 召唤 Ruby 工程师,一起探索个性化教育 at 2016年03月26日

    冲着楼主的教程 https://github.com/lifedim/SwiftCasts/tree/master/001_swift_counter/Tutorial, 支持下

  • 使用 Rails 构建 API 实践 at 2016年03月22日

    #131 楼 @wahahaha 你可以做个试验,

    res = 1 && 2
    res #=> 2
    

    && 这个符号的计算有下面两种情况

    1. 对左边的对象求 boolean 值,左边的对象的 boolean 值为 true, 返回右边对象
    2. 对左边的对象求 boolean 值,左边的对象的 boolean 值为 false, 返回左边对象

    ruby 中只有两个对象的 boolean 值为 false: nil 和 false, 其他对象的 boolean 值都为 true.

    user = user_email && User.find_by(email: user_email)
    

    相当于

    if user_email
      user = User.find_by(email: user_email)
    end
    
  • 使用 Rails 构建 API 实践 at 2016年03月11日

    #128 楼 @embbnux 不错

  • [深圳] DJI 大疆创新 Q1 招聘 Ruby 工程师 3 + 2 名 (saberma 内推 15-30k) at 2016年02月18日

    支持一下,很牛的公司

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