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

[email protected]
深圳
182 Topics / 9132 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 January 21, 2014

    #11 楼 @satoshigi 从数据管理角度,这是两个物品了。一般电商网站会保留所有商品信息和订单信息,商品条目只会软删除,你需要的 prize 表,比较像订单。

  • rails 范围查找函数有吗 (已解决) at January 21, 2014
    LEVEL_TABLE = [100, 200, 500]
    
    def level
      LEVEL_TABLE.index { |exp| exp > self.exp }
    end
    
  • 搞不懂关联表之间要怎么对不是主键的数据进行操作 at January 21, 2014

    #9 楼 @satoshigi 我觉得礼物的 id 是不变的啊,比如有 ID 为 1~10 的物品,今天允许选 1~6,明天允许选 5~9,但是礼物的 id 没变啊。

  • 搞不懂关联表之间要怎么对不是主键的数据进行操作 at January 21, 2014

    #7 楼 @satoshigi 意思是顶楼的 prize 表已经是关联表吗?补充一些详细的业务描述和数据描述,现在看不明白,为什么 prize 表里面同时有 id 和 prize_id,prize_id 指向哪?

  • 搞不懂关联表之间要怎么对不是主键的数据进行操作 at January 21, 2014

    #5 楼 @satoshigi 多对多关联,has_and_belongs_to_many,prize 表只要 name 和 id,再加一个关联表 users_prizes ( user_id, prize_id ),users 表也去掉 prize_id。

  • 搞不懂关联表之间要怎么对不是主键的数据进行操作 at January 21, 2014

    #3 楼 @satoshigi 别说你想查什么(代码层),说你想做什么(业务层)。

  • 搞不懂关联表之间要怎么对不是主键的数据进行操作 at January 21, 2014

    这特么是个多对多关联吧,看 has_and_belongs_to_many

    http://guides.rubyonrails.org/association_basics.html#the-has-and-belongs-to-many-association

  • 搞不懂关联表之间要怎么对不是主键的数据进行操作 at January 21, 2014
    class User
      belongs_to :prize, primary_key: 'prize_id'
    end
    

    隐约觉得是个 X-Y 问题,楼主你原本想干嘛?

  • rails 范围查找函数有吗 (已解决) at January 21, 2014

    应该是这个意思

    def level
      if exp > 100
        1
      elsif exp > 200
        2
      elsif exp > 500
        3
      end
    end
    

    求简化。

  • 丢帖子了么? at January 21, 2014

    已恢复。

  • 丢帖子了么? at January 21, 2014

    #3 楼 @luliangshu 你要考虑回答问题的人的心情啊,劳动成功被消除了。以后别人遇到同样问题的也可以搜进来,不犯同样错误。

    如果你同意我可以恢复帖子。

  • 丢帖子了么? at January 21, 2014

    楼主自己删了 @luliangshu

  • 请问在 model test 中的 assert_equal 是否支持中文 at January 20, 2014

    product.errors[:price] 应该是个数组。

    一般测 assert product.invalid? 就够了。

  • 别用 CoffeeScript 了,你总有一天得学 JavaScript at January 20, 2014

    #36 楼 @jeff_duan 我前阵子才留意到的:coffee-script、backbone、underscore 的作者是同一人

    https://github.com/jashkenas?tab=repositories

  • 请教:DNSPod 和 Linode 主机关于域名的一点小问题 at January 20, 2014

    #6 楼 @chairy11 不过这个问题很适合问你的小伙伴:“你设置了什么没有”

  • 请教:DNSPod 和 Linode 主机关于域名的一点小问题 at January 20, 2014

    #2 楼 @chairy11 提问半途而废,下次提问都会回复你“找你小伙伴弄弄看”。

  • 别用 CoffeeScript 了,你总有一天得学 JavaScript at January 20, 2014

    #25 楼 @ShiningRay generator 出来浏览器不支持啊。

  • 别用 CoffeeScript 了,你总有一天得学 JavaScript at January 20, 2014

    #17 楼 @lgn21st #论阅读原版资料的重要性

  • 别用 CoffeeScript 了,你总有一天得学 JavaScript at January 20, 2014

    对,总要学 JavaScript 的,然后认识到 CoffeeScript 解决了什么问题之后开始用 CoffeeScript。

  • Ruby 1.9+ 的字符编码 at January 20, 2014

    #8 楼 @zw963 不加精就会影响积极性吗?如果是我发贴,有内容的交流比管理员认证更让我高兴。

  • Ruby 1.9+ 的字符编码 at January 20, 2014

    #5 楼 @zw963 因为世界上有太多事比加精一个帖子重要且有趣。

  • 我应该如何使用 git 呢 at January 20, 2014

    答 1

    1. 方便 code review
    2. 如果发现 commit 有个严重缺陷,需要回滚,功能独立的时候一个 git revert <commit> 就行了,否则就要手工 revert
  • Puma、Unicorn 吞吐量在实际应用中如何? at January 19, 2014

    #2 楼 @Victor 像 3 楼说的,用防火墙屏蔽掉访问太频繁的请求。

  • Puma、Unicorn 吞吐量在实际应用中如何? at January 19, 2014

    测吞吐量用这个

    ab -c 并发数 -n 请求次数 地址
    
  • 如何有效提升 'Ruby 编程' 的能力 at January 19, 2014

    楼主觉得做网站没有技术含量?

  • Rails 项目中针对 select 或 radio 值变化显示不同的 input at January 18, 2014

    两个表。

  • 哈哈,我终于不用羡慕 iawriter 了 at January 16, 2014

    #22 楼 @xautjzd 我没装 tmux 和 powerline,没遇到过这问题。

  • 哈哈,我终于不用羡慕 iawriter 了 at January 16, 2014

    #20 楼 @xautjzd 再输入一次 :Goyo 退出

  • vim 求助 at January 16, 2014

    #27 楼 @wcp1231 第一批已经卖完了,第二批 1 月 23 日开卖

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