Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
@vkill
VIP
NO. 120 / 2011-11-17

7 Topics / 294 Replies
4 Followers
0 Following
114 Favorites
No GitHub.
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 使用 Rails 的阶段性总结. at April 13, 2012

    rails 走的非常考前,哈哈

  • 有没有什么安全的文件删除策略? at April 13, 2012

    rm -rf @tmp_dir 才对啊,后面加啥 /* 呢?

  • pry 代替 Rails console 的 irb,不用加进 Gemfile at April 12, 2012

    一直是加到 Gemfile 里用的,加个 staging env 进去就更好了

  • qwandry - 帮你快速打开 gem 的源代码 at April 12, 2012

    gemedit 和 open_gem

  • 请教,如何缩短整体测试的运行时间? at April 07, 2012

    跑测试 内存 不需要多高,关键是 cpu

  • 初学者连载系列之二十一:instance_eval 与 class_eval 的区别 at April 07, 2012

    类 本身是类,但同时是 Class 的实例,(这个比较绕)。 所以我们用 A.instance_eval 和 A.class_eval 来定义 @xx 是一样的,但定义 def xx 就不一样了,前者是单键方法(类方法也是单键方法),后者是实例方法。

    a = "a" a.instance_eval {def a; p 1; end} a.a # => 1 a.respond_to?(:class_eval) # => false

    这样举例更明白一点呢。

  • rails c 问题求解 at April 06, 2012

    17 楼 +1

  • 如何提高自己的自制力? at April 04, 2012

    感觉到压力的时候,你从学校毕业干两年工作就明白了

  • 个性化你的 Git Log 的输出格式 at April 04, 2012

    好文,前两天同事问查找某些 commit 内容包括某个特定字符的东西的时候不知道怎么弄,看了这个搞定,谢谢

    # git shortlog --format='%H|%cn|%s' | grep '#2230'
    
    
  • Linuxer 们,都用什么发行版 /WM/DE 啊。扯扯淡 at April 02, 2012

    arch gnome -> xfce4 -> kde -> e17

  • 一个 model 中两个字段引用相同的 model 该怎么写 migrate? at April 02, 2012
    t.integer :b1_id
    t.integer :b2_id
    
    

    model 里看 has_many belongs_to 的 :class_name 和 :foreign_key 参数 Similarly, belongs_to :favorite_person, :class_name => "Person" will use a foreign key of “favorite_person_id”.

  • 按一定的概率随机给出键,怎么实现好 at April 01, 2012

    #14 楼 @fredwu 可以使用 rand(100) 这样就不会出现 float 精度的问题了

  • 大家的 home 目录下都有些什么程序? at March 31, 2012

    只用 root,家目录啥都没

  • 感觉自己已经成了 alias 的奴隶了. at March 31, 2012
    # alias | wc -l
    94
    
    

    也挺多

  • -> 是关键字吗? at March 30, 2012

    #3 楼 @FenRagwort 嗯,谢谢

  • 如何让 scope 可以携带参数 at March 30, 2012

    #15 楼 @kevinhua http://ruby-china.org/topics/777 http://ruby-china.org/topics/783

  • -> 是关键字吗? at March 30, 2012

    #1 楼 @FenRagwort 那是?

  • 如何让 scope 可以携带参数 at March 30, 2012

    #6 楼 @kevinhua 改用 -> 吧,跨行的话用 lambda 总是会忘记那个 () ,导致莫名其妙的提示一个语法错误,重点是发现不了是这里丢了 (),-> 还能设置默认值

    scope :admin, ->(company_id){ where(:company_id => company_id)}
    
    
  • 类名转化为符号最便捷的方法 at March 29, 2012

    那个没啥破坏性,哈哈

  • 怎样带领好一个 Rails 团队? at March 29, 2012

    楼上说的太好了,喜欢

  • 请教个路由的问题 示例 depot, 章节 8.1 Iteration C1: Creating the Catalog Listing at March 28, 2012

    建议楼主先从 ruby 学起啊,不然会碰到很多本身不是莫名其妙的问题啊

  • Rspec 和 Foreign Key 的问题 at March 28, 2012
    let(:camera_report) { create(:camera_report, call_sheet: nil) }
    
    

    不过这样的话

    it { should belong_to(:call_sheet) }
    
    

    这句会不会测试不通过就不晓得了,未测试

    测试嘛,费时间就费了哈,实在不行换配置高的机器,太在意这个反而会导致测试不完全

    发完了再看下,觉得怪怪的,不都是下面这样写吗?

    let(:camera_report) { Factory(:camera_report, call_sheet: nil) }
    
    
  • 请教 Rails 3 image_tag 怎么显示其它路径的图片? at March 28, 2012

    配合 nginx 就 ok 啊

  • 如何才能很好地继承类,但又避免重复编码? at March 27, 2012

    如果只看 Movie < Topic,那么我的理解就是多表继承,如果是多表继承,那么只需要写 topic 的 controller 和 view,路由里多写几条 resources,controller 和 view 中使用 [xx,xx] 的方式来写路由就 ok

  • 广州有公司招初级 Ruby 程序员吗? at March 26, 2012

    不是那个海盗在广州吗?

  • 我终于还是被 Debian 给击败了。 at March 26, 2012

    #36 楼 @reus 哈哈,就是,wiki 基本上都能搞定

  • [上海] iOSCon2012 全部演讲视频放出 at March 26, 2012

    端木的看了,后面讲日历的挺好的

  • 其他地方获取数据,然后写入数据库,已经开发 api,如何后端批量 insert?? at March 26, 2012

    #3 楼 @ywjno 这样不算 batches insert,执行这个后看 sql 还是一条一条 insert 的。 楼主这个需求可以自己构造 sql 语句,Model.connection.execute(sql),也可以使用 rails 提供的方法 http://apidock.com/rails/ActiveRecord/ConnectionAdapters/DatabaseStatements/insert_fixture

  • 我终于还是被 Debian 给击败了。 at March 26, 2012

    #19 楼 @reus #20 楼 @Juanito #24 楼 @wikimo 不推荐不喜欢折腾 linux 的人用 archlinux 啊,你会碰到比楼主所碰到的还要多的问题,像这两天 openssl 更新了就使用不了某些 ssl 了,最后还是降低版本解决问题

  • 能在 rake db:migrate 的时候指定数据库名吗? at March 25, 2012

    楼主你的需求可以看看这个 gem https://github.com/karledurante/secondbase 或者这个 gem https://github.com/kovyrin/db-charmer

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