Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
@metal
VIP
NO. 475 / 2011-12-14

84 Topics / 517 Replies
5 Followers
0 Following
39 Favorites
No GitHub.
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 瞎折腾了一下博客,推荐下便宜的 VPS 跟 SSL 服务 at March 12, 2013

    #18 楼 @cqpx 和你一模一样的情况。不知道为什么,第一次非常慢,加载完以后就很快,都是秒开。你是 chrome?

  • 瞎折腾了一下博客,推荐下便宜的 VPS 跟 SSL 服务 at March 11, 2013

    mark 留名。

  • 如果把 Ruby China 的回帖改成 Nested 咋样? at March 11, 2013

    其实我很感兴趣是如何实现的。

  • writings.io - 提供在线文章写作、管理、发布的网站服务 at March 07, 2013

    #4 楼 @Teddy 和简书不一样的。writings 更加有个人色彩,比如绑定域名,比如第三方社会化评论系统 Disqus。

  • 新手学习 Rails 的困惑 at March 06, 2013

    可以学习 sinatra

  • Goagent 证书错误 at March 06, 2013

    我也一样。一直到现在没搞定。我的解决方法是用 safari 打开一次,safari 也会有一样的提示,不过 safari 可以去设置这个证书是否可以信任。

  • 在 openshift 上部署 rails,application.css 无内容 at March 06, 2013

    #6 楼 @rubybird 我看了一下 rails 默认 application.css 就是 css。。。应该没关系。

  • 在 openshift 上部署 rails,application.css 无内容 at March 06, 2013

    看了一下原来 application.css 就是默认。真是搞不懂。我上次也有这样的问题。后来发现没有

    bundle exec rake assets:precompile RAILS_ENV= production
    
  • 在 openshift 上部署 rails,application.css 无内容 at March 06, 2013

    #3 楼 @rubybird 你有没有试过吧 application.css 改成 application.css.scss

    不知道 rails 会不会去识别 css 里这样的东西。

    *= require_self
    *= require_tree .
    
  • 在 openshift 上部署 rails,application.css 无内容 at March 06, 2013

    和我当时一样。不知道你看过这个没有,没看过的话现在可以看看。我认为是没有执行

    bundle exec rake assets:precompile
    

    或者关闭

    http://guides.ruby-china.org/asset_pipeline.html#1

  • 重写 destroy 方法有问题。 at March 05, 2013

    我自己试了一下原来这样是可以的#{}.

  • 重写 destroy 方法有问题。 at March 05, 2013

    正则表达式我还在学,不过我看着正则有点问题。{} 在正则里是语意的。

    你这样把 2 个 email 拿出来测试一下看看就行了

    rubular.com 你知道吧。复制上去测试一下。很简单。自己能写测试更好。很容易找出来。

  • 一边听 teahour,一边写 ios 代码,你们猜是什么感觉 at March 05, 2013

    我也是,不过我这样是一点也没有听进去。

  • 阅读 PDF 的终端 (小调查) at March 05, 2013

    kindle dxg 文本类的电子书,小说之类的。 还有一台 android 读扫描类的。

  • Gemfile.lock 該加入 .gitignore 嗎? at March 02, 2013

    我用了某个 rails 社区的源码在本地环境。结果我其他的 app 直接无法启动了。来下面的错误。

    You have already activated eventmachine 1.0.1, but your Gemfile requires eventmachine 1.0.0. Using bundle exec may solve this. (Gem::LoadError)
    

    我把 gemfile.lock 删除,重新 bundle 一次就好了,我不知道具体是什么原因。

  • Ruby-2.0.0-p0 at February 28, 2013

    我很顺利呀。

  • 求购《Ruby 编程语言》作者: David Flanagan / 松本行弘 出版社: 电子工业出版社 at February 27, 2013

    入门吗?别看这本。这本我叫 ruby-doc。我还不如上 ruby-doc 去自己查。

  • Ruby China 开始用 Ruby 2.0 跑了 at February 27, 2013

    #68 楼 @ghawkgu 不需要呀。sinatra 直接就跑起来了。。

  • 求助 Ruby 如何连接 MySQL at February 27, 2013

    http://www.kitebird.com/articles/ruby-dbi.html

  • Ruby China 开始用 Ruby 2.0 跑了 at February 26, 2013

    是快了很多了。!

  • stackoverflow 的编辑会人肉修改你的提问呢 at February 24, 2013

    #3 楼 @doitian 我以为是编辑修改的。还是用户修改的。3Q

  • update_attributes 时,假如数据没变,其实他不会更新的吗 at February 22, 2013

    我以前写了一个 before_save { xxxxx }。如果内容不变,这个回调无法生效。

  • Espresso Framework at February 22, 2013

    刚刚小试了一把,感觉还可以和 padrino 差不多的东西。。。不知道怎么在开发模式下 reloader,难道非得用 shotgun 来启动。

  • has_secure_password 关于 password_confirmation 的疑惑 at February 18, 2013

    #2 楼 @Vincent178 你点一下souce show看看。

    def has_secure_password
      # Load bcrypt-ruby only when has_secure_password is used.
      # This is to avoid ActiveModel (and by extension the entire framework) being dependent on a binary library.
      gem 'bcrypt-ruby', '~> 3.0.0'
      require 'bcrypt'
    
      attr_reader :password
    
      validates_confirmation_of :password
      validates_presence_of     :password_digest
    
      include InstanceMethodsOnActivation
    
      if respond_to?(:attributes_protected_by_default)
        def self.attributes_protected_by_default
          super + ['password_digest']
        end
      end
    end
    

    我这几天也遇到同样的问题,后来我发现是 password 要和 password_confirmation 同时使用的,原因也是在上面,因为 validates_confirmation_of :password 只是验证了 password。

    user = User.new(:name => "metal", :password => '123456', :password_confirmation => nil)
    user.valid? # true
    
    user = User.new(:name => "metal", :password => '123456', :password_confirmation => '')
    user.valid? false
    user.errors.messages # {:password=>["两次输入的密码不相同"]}
    
  • has_secure_password 关于 password_confirmation 的疑惑 at February 18, 2013

    第一确保 model 里加入了 validates_confirmation_of :password

    password_confirmation 要和 password 一起提交,password_confirmation 才有用。一般都不会验证 password_confirmation 的。

  • 纯菜鸟 - 求 Ruby 入门书籍推荐 at February 17, 2013

    meta programming 不一定要是要强学的。

    method_missing, defined_method, eval, scope 这些这本讲的太生动了。LRTHW 让你去 github 找源码,找一个自己感兴趣的,然后一读,里面或多或少带有这些东西。去看文档吧,高级东西都变得很抽象,理解起来不易,菜鸟、高手 meta programming 值得拥有的。

  • 纯菜鸟 - 求 Ruby 入门书籍推荐 at February 16, 2013
    1. 《Learn Ruby The Hard Way》
    2. 《Programming Ruby》
    3. 《Ruby 元编程》
  • 有谁在 CentOS 上布署过 RoR 么? at February 16, 2013

    我装过一次。因为别人说 centos 更安全。结果我折腾了一天多!vps 重装系统 N 次!最后放弃了。

  • includes 的小问题求教 at February 01, 2013

    #4 楼 @williamherry 看起来你的查询比我的高级一些。你说的这种方式我都没用过。你去http://guides.ruby-china.org/active_record_querying.html#13 看这一节,讲复杂查询的。最主要是你到底要做什么,我不明白,取出 HotActivity 里的数据?还是 Activity 数据?

  • includes 的小问题求教 at February 01, 2013

    我没见过这种写法。

    @hot_activities = HotActivity.includes(:activity => :activity_type)
    

    我在文档上看到的一般是这样

    HotActivity.includes(:activity, :activity_type)
    

    或者

    HotActivity.find(:all, :include => [:activity, :activity_type])
    

    http://guides.ruby-china.org/active_record_querying.html#12

    http://guides.ruby-china.org/active_record_querying.html#13

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