Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
guange
@hhuai
高级会员
第 917 位会员 / 2012-02-05

长沙
41 篇帖子 / 836 条回帖
12 关注者
0 正在关注
0 收藏
既然这样了,看来不做个惊天地,泣鬼神的js项目,会被大家瞧不起。
GitHub Public Repos
More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Ruby China Notifier - 通知实时提醒器 Mac 版本发布 at 2012年09月11日

    坐等 node.js 脚本,我直接放到 lauchagent 就好。

  • 为什么 Mac 是开发者首选的平台? at 2012年09月05日

    因为 ruby 没办法加快在 windows 上的速度,不懂为啥一个缺点怎么会变成吹唬的优点了。

  • 为什么我的 ActiveRecord 的 foreign_key 设置了,死活不生效啊 at 2012年08月23日

    看起来木啥问题,但第一个参数可以用类名吗,不是用小写那种?

    belongs_to :comm_event, :foreign_key => "event_id"
    
  • 什么时候使用 module,什么时候使用 class at 2012年08月23日

    #4 楼 @xuluan 跟抽象类没关系,ruby 中不搞这概念。ruby 来的是 ducking type。抽象和接口更多的作用是强制约束,目的不是代码复用。

  • 什么时候使用 module,什么时候使用 class at 2012年08月23日

    当 class 中或多个 class 中有重复代码需要抽象出来时,你会想要一个 module 的东东。 因为不能多重继承,只好用 module 来补偿一下。

    另一点我觉得更容易解耦,继承哪个类,你只能选一个,但具体要 include 哪几个 module 你可以根据不同需求选择不同的 module. 有了 autoload 更加能优化性能。

    总的一点来说,顺其自然,你当前用什么能达到目的就用啥,过几个月或几个星期,觉得以前的写法不爽时你会自己回来重构的。

  • 正在看一套 Sinatra 的教程,看到一半卡壳了,希望大侠帮帮我 at 2012年08月17日

    呵呵,你可以看 params[:task] 是一个什么东东,puts params[:task].inspect 一下,他应该是个 hash,包含了 name 这个 key

  • 源码中 ActiveRelation::Base 的 all 方法 (?) 定义在哪里??? at 2012年08月16日

    #12 楼 @jjym 你是什么版 本啊,我这是 delegate 到 scoped, scoped 再对应到 relation 中。

    delegate :find, :first, :first!, :last, :last!, :all, :exists?, :any?, :many?, :to => :scoped
        delegate :first_or_create, :first_or_create!, :first_or_initialize, :to => :scoped
        delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, :to => :scoped
        delegate :find_each, :find_in_batches, :to => :scoped
        delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins,
                 :where, :preload, :eager_load, :includes, :from, :lock, :readonly,
                 :having, :create_with, :uniq, :to => :scoped
    
    # File activerecord/lib/active_record/scoping/named.rb, line 30
    def scoped(options = nil)
      if options
        scoped.apply_finder_options(options)
      else
        if current_scope
          current_scope.clone
        else
          scope = relation.clone
          scope.default_scoped = true
          scope
        end
      end
    end
    
  • 源码中 ActiveRelation::Base 的 all 方法 (?) 定义在哪里??? at 2012年08月16日

    https://github.com/rails/rails/blob/c9f27e3a479e17cd94248c007e4f528026bc18f6/activerecord/lib/active_record/relation/finder_methods.rb#L158 是不是这个?

  • Windows 8 对 Ruby 的支持 at 2012年08月16日

    如果 Ruby 真的火起来了,说不好哪天 windows 就会像对 node.js 一样。

  • 如何将已有的数据库移植到新的 rails 中 at 2012年08月16日

    关于迁移这个,有本书写得特别好,中文叫什么 rails 项目实战之类的,虽然用的是 rails 1.2,但我觉得作者的理念一点也不过时,作者本身是一名 dba,里面有个项目应该是真实案例,用来迁移旧的 php 系统,涉及到大量的旧数据库迁移知识。

  • 关于 Assets Pipeline at 2012年08月16日

    我不是很喜欢,但系统提供了,就用用呗。

  • 用 ruby.taobao.org 不是一般的蛋疼阿 at 2012年08月16日

    你自己蛋疼啊。上 heroku 用什么 taobao 源。我刚好上传,用得好好的。

    practice$ git push heroku master
    Counting objects: 43, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (24/24), done.
    Writing objects: 100% (25/25), 2.44 KiB, done.
    Total 25 (delta 19), reused 0 (delta 0)
    
    -----> Heroku receiving push
    -----> Ruby/Rails app detected
    -----> Installing dependencies using Bundler version 1.2.0.rc.2
           Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
           Using rake (0.9.2.2)
    
  • 可以升 10.8 了,很好很顺畅。 at 2012年08月16日

    不要以 windows 的思想去用 unix 系统,你管他用几 g,剩几 m, 安心做你的事就是了,系统用着顺畅就好了。你内存留着干嘛,让系统自己去调控就是了,他爱释放就释放,缓存就缓存。 都被 360 给搞蒙了

  • 可以升 10.8 了,很好很顺畅。 at 2012年08月15日

    #2 楼 @diudiutang osx-gcc-installer 是什么,我从来没用过。 装好 xcode 后,装个 command line tool 就好了。

  • 请教一个新手是否应该选择 Ruby 的疑惑 (与 ASP.NET MVC 比较)。 at 2012年08月15日

    你是做.net 的,就用.net 搞。以最快的速度做出你那个对你以后影响很大的项目,发财了再回过来随便玩玩吧。

  • 中断的本质是什么 at 2012年08月15日

    无语。

  • 想买新的本,不知道买什么样的好 at 2012年08月14日

    #29 楼 @willmouse ok. you win

  • 在使用 spork 过程中有没有遇到这个问题? at 2012年08月14日

    把 gem 'spork'换成 gem 'spork-rails'

  • 想买新的本,不知道买什么样的好 at 2012年08月14日

    上 pcbeta 看看,有没有完美黑苹果的 thinkpad 笔记本,想用 win 用 win,想用苹果用苹果,两全其美。 不做 iphone 开发,买 mac 干球。

  • 中断的本质是什么 at 2012年08月14日

    #12 楼 @jiffies 你没理解,中断不是主动去轮询发现的,那是同步的。 中断有两种,一种是硬的,一种软的,硬的明显就是指硬件中断了,时钟中断,键盘中断这些,主动去通知 cpu,而操作系统一般会设置一个中断描述符表去接收这些中断。

    软的就懒得解释了。

    总的一点,就是中断不是你来发现,是他来找你。对,跟艳遇差不多。

  • 请教个小白问题 at 2012年08月09日

    rake assets:clean

  • 怎么最快让一个老版本的 application 跑起来? at 2012年08月09日

    rvm 建 gemset

  • Linux 下 Rails 配置后建立项目遇到的问题 at 2012年08月09日

    底下的错误信息已经写得非常清楚了, using RVM are available at rvm.io/packages/openssl

  • rails 模型校验中文问题…… at 2012年08月08日

    #3 楼 @kaitokid1224 https://github.com/plataformatec/simple_form/ 你看看这里关于 i18n 的说明能看懂不。 看不懂的话,哥给你弄个 demo 吧。

  • ruby 项目如何像 rails 那样数据库可以分为 production, development 和 test? at 2012年08月08日

    很简单。搞个全局变量做判断就好了。

  • 我写了一个小工具,加强在 Windows 上开发 Rails 的体验。 at 2012年08月08日

    #23 楼 @RainySummer 我的推荐是,你搞个 putty,然后在里面 debug 吧。

  • 在 rails 中 call shell 到另外一个项目中执行命令? at 2012年08月08日

    你看看是不是环境有问题哦,在里面把当前的 env 给打出来。bundle 不一定在当前 path 下有。

  • 我写了一个小工具,加强在 Windows 上开发 Rails 的体验。 at 2012年08月08日

    #21 楼 @dfang 问题就是 ubuntu 没啥好用的应用软件啊。意思是只要配置没这么麻烦,你就可以接受了是吗?

  • Moutain Lion 下安装 Ruby 1.9.3 at 2012年08月07日

    osx-gcc 有 apple 的 llvm 好吗。

  • Rails 下有什么比较好的博客框架嘛? at 2012年08月07日

    如果单纯是使用而已,用 php 的吧,一大堆优秀的博客,在 sae 点击几下就好了 如果想通过源码学习,另当别论。

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