Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
@palytoxin
会员
第 7379 位会员 / 2013-05-31

在人间
5 篇帖子 / 69 条回帖
3 关注者
3 正在关注
46 收藏
未设置 GitHub 信息。
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 有朋友在国内服务器上通过 Kamal 成功部署 Rails 应用吗? at 2025年03月31日

    问题确实是网络,需要每一步请求都规避访问外面。不用部署 xray 倒是也不麻烦

  • 大家在开发 rails api 的时候是否遵循 jsonapi 规范 at 2023年09月24日

    曾经用过,不建议使用,心智负担大,用了别人库,更新也很麻烦

  • Stimulus 安装出现 Command failed with exit code 1.错误处理 at 2022年12月23日
    export NODE_OPTIONS=--openssl-legacy-provider
    

    https://github.com/nodejs/node/issues/40455

    发文别学 CSDN

  • 关于用 Docker 离线部署我的做法和讨论 at 2021年09月06日

    就是用 docker 搞了套运行环境而已

  • 关于用 Docker 离线部署我的做法和讨论 at 2021年09月06日

    明白了 我去试试 谢谢🍺

    ===

    update:

    stop 再 start 其实只是停止了 container 的运行,并没有移除,所以是没有更新的。 需要 docker-compose rm container 一下

  • 关于用 Docker 离线部署我的做法和讨论 at 2021年09月03日

    请问 1 中,openresty 是在 docker-compose 中运行的,如果重启势必会一并把 openresty 干掉。而单独重启 rails 的服务并且交替启动,我该如何在 docker-compose 中操作?原理可以理解成再启动一个 container 然后 web server 替换掉再干掉旧的,但是具体操作不太会

  • 数据库列名与 Rails 方法名冲突怎么解决? at 2021年03月07日
    def new_attr
      read_attribute(:old_attr)
    end
    
  • 我们将会在 2016-01-23 (本周六) 对服务器停机升级 at 2016年01月27日

    #53 楼 @huobazi 非常感谢

  • 我们将会在 2016-01-23 (本周六) 对服务器停机升级 at 2016年01月27日

    #52 楼 @huacnlee 头像无所谓,说 mini-profiler 的事情,我好长时间没来,我的错 最主要的是我很卡

  • 我们将会在 2016-01-23 (本周六) 对服务器停机升级 at 2016年01月27日

    #50 楼 @huacnlee 账号是我本人,我以前穿过头像。

  • 我们将会在 2016-01-23 (本周六) 对服务器停机升级 at 2016年01月27日

    而且我的头像挂了

  • 我们将会在 2016-01-23 (本周六) 对服务器停机升级 at 2016年01月27日

    #44 楼 好长时间没来,issue feature 分不清我的错

  • 12 周 12 个应用,很不错的 Rails 入门视频 at 2015年01月02日

    We're sorry, but something went wrong.

  • 大家是如何解决 Ubuntu 下安装 Rails 的网络问题的 at 2014年12月31日

    推荐 ustc https://lug.ustc.edu.cn/wiki/mirrors/help/rubygems

  • Ruby 2.2 发布了 at 2014年12月31日

    http://www.reddit.com/r/ruby/comments/2qipvi/ruby_22_all_my_wow/ 这里跑了几个 benchmark 挺有趣

  • Flip Flop Operator in Ruby [Ruby 中的触发器操作] (..) at 2014年11月25日

    #3 楼 @colorfulberry flip-flop 和 range 完全不是一个东西。

  • Flip Flop Operator in Ruby [Ruby 中的触发器操作] (..) at 2014年11月24日

    在我的 rmbp 上,帖子右下角的按钮对齐很奇怪,是我个人的问题么?

  • Ruby 的方法查找与 method_missing at 2014年09月01日

    后面的 benchmark 没看出 require active_record 的必要性。。。

    method_missing 不会因为速度必须定义 dynamic method,感觉方便不少

  • [太原] 诚招 Ruby on Rails 工程师! at 2014年07月29日

    #7 楼 @jksharer 已申请群 ww

  • [太原] 诚招 Ruby on Rails 工程师! at 2014年07月28日

    #3 楼 @jksharer O_o 太原真的好少,地点在高新区那边不?过年那阵到处拆拆拆,简直不能走

  • Rails 3.2.13 使用 Spork + Guard + RSpec + Capybara at 2014年07月21日

    我这边 windows7 用 unit test 在 opensuse 下什么问题都没有 切 windows 下面提示,然后修改文件是没有反应的。也就是说没有监视到文件的变化

    Please add the following to your Gemfile to avoid polling for changes:
      require 'rbconfig'
      if RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i
        gem 'wdm', '>= 0.1.0'
      end
    

    然后我加了 wdm,再然后

    11:21:07 - INFO - Guard is now watching at 'F:/src/guard'
    Process finished with exit code -1073741819
    

    rubymine 中会有Process finished with exit code -1073741819 而 cmd 终端显示 now watching 之后就直接显示 F:\src\guard>

    同样的代码,opensuse 完全木有问题,求问是怎么回事

    guardfile

    guard 'spork', :test_unit => true, :test_unit_env => {'RAILS_ENV' => 'test'}, :wait => 60 do
      watch('config/application.rb')
      watch('config/environment.rb')
      watch('config/environments/test.rb')
      watch(%r{^config/initializers/.+\.rb$})
      watch('Gemfile.lock')
      watch('spec/spec_helper.rb') { :rspec }
      watch('test/test_helper.rb') { :test_unit }
      watch(%r{features/support/}) { :cucumber }
    end
    
    guard :test, :drb => true, :all_after_pass => false, :all_on_start => false do
      watch(%r{^test/.+_test\.rb$})
      watch('test/test_helper.rb')  { 'test' }
    
      # Non-rails
      watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
      watch(%r{^app/models/(.+)\.rb$})                   { |m| "test/unit/#{m[1]}_test.rb" }
      watch(%r{^app/controllers/(.+)\.rb$})              { |m| "test/functional/#{m[1]}_test.rb" }
      watch(%r{^app/views/(.+)/.+\.erb$})                { |m| "test/functional/#{m[1]}_controller_test.rb" }
      watch(%r{^app/views/.+$})                          { 'test/integration' }
      watch('app/controllers/application_controller.rb') { ['test/functional', 'test/integration'] }
    end
    
    

    gemfile

    source 'https://ruby.taobao.org'
    require 'rbconfig'
    if RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i
      gem 'wdm', '>= 0.1.0'
    end
      ...
    group :development, :test do
        gem "guard-rails"
        gem 'spork-testunit'
        gem 'guard-spork'
        gem 'guard-test', '~> 1.0.0'
        gem 'ruby-prof' 
        gem 'pry'
        gem 'pry-nav'
      gem 'childprocess'
    end
    
    group :test do
      gem "shoulda", "> 3.3.2"
      gem "mocha", "~> 0.13.3"
      gem 'capybara', '~> 2.0.0'
      gem 'nokogiri', '< 1.6.0'
      gem 'factory_girl'
      gem 'rb-fchange', '0.0.5'
      gem 'rb-notifu', '0.0.4'
      gem 'win32console', '~>1.3.0'
    end
      ...
    
  • 现在 Ruby China 主站开启 SSL at 2014年05月24日

    opera coast 表示满意

  • Sublime Text 2 安装了 ConvertToUTF8 也不支持中文 at 2014年05月21日

    #1 楼 @moioo 感谢

  • 请教一个 nginx 反向代理的问题 at 2014年05月21日

    试试这个 https://github.com/yaoweibin/ngx_http_substitutions_filter_module

  • ruby 的 extend 方法为什么在类和实例上实现的逻辑不一致 at 2014年05月20日

    #16 楼 @lihaidong 没明白就乱说见笑了。这个栗子我还是有点自己的理解 其实上方的代码最重要的区别在class << self这句

    class << self
       def bar
          "bar in the class FooBar"
       end
     end
    

    这个打开类,是在 eigenclass 内,定义了一个 instance_method bar

    FooBar.singleton_class.instance_methods(false)
    #=> [:bar]
    

    而FooBar.extend Foo 把 Foo 混在了 eigenclass 上方 extend 混入,实际上是在 eigenclass 里调用了 include,那么这个模块以虚拟类放在了 eigenclass 的上方

    FooBar.singleton_class.ancestors
    #=> [Foo, Class, Module, Object, Kernel, BasicObject]
    

    一个定义在 eigenclass 内,一个被混入放在了 eigenclass 上 这就是为什么" extend 方法为什么在类和实例上实现的逻辑不一致" 其实是一致的,只不过你用的这个栗子 class<<self,正好造成了这种困扰

    昨天扣了半天书本,觉得把自己说服了,欢迎讨论,求拍砖:)

  • ruby 的 extend 方法为什么在类和实例上实现的逻辑不一致 at 2014年05月19日

    我又去翻了翻书。 发现之前对 include 和 module 中对方法的继承确实有误解 extend 实际相当于

    class << xxx
      include module
    end
    

    然后我改写下代码 1

    module Foo
      def bar
         "bar in the Module Foo"
      end
    end
    
    class FooBar
      def bar
         "bar in the class FooBar"
      end
    end
    
    f = FooBar.new
    class << f
        include Foo
    end
    f.bar 
    

    代码 2

    module Foo
       def bar
           "bar in the Module Foo"
       end
    end
    
    class FooBar
      class << self
         def bar
            "bar in the class FooBar"
         end
       end
    end
    
    class << FooBar
        include Foo
    end
    
    FooBar.bar
    

    然后代码 2 再多手简化下

    module Foo
       def bar
           "bar in the Module Foo"
       end
    end
    
    class FooBar
      class << self
         def bar
            "bar in the class FooBar"
         end
         include Foo
       end
    end
    
    FooBar.bar
    

    不知道这样 lz 能明白么

    然后看一下这些东西的祖先链

    module Foo
      def bar
         "bar in the Module Foo"
      end
    end
    
    class FooBar
        include Foo
    end
    
    class << FooBar
        include Foo
    end
    
    FooBar.ancestors #=> [FooBar, Foo, Object, Kernel, BasicObject]
    
    ss = class << FooBar
        self
    end
    ss.ancestors #=> [Foo, Class, Module, Object, Kernel, BasicObject]
    
  • ruby 的 extend 方法为什么在类和实例上实现的逻辑不一致 at 2014年05月19日
    module Foo
      def bar
         "bar in the Module Foo"
      end
    end
    
    class FooBar
      def bar
         "bar in the class FooBar"
      end
    end
    
    f = FooBar.new
    f.extend Foo
    p f.bar
    

    f.bar 查找链难道不是 f --> f(eigenclass) ,然后在 f(eigenclass) 发现了 bar? 怎么会跑到了 Object 的 class 和 eigenclass 的中间

  • ruby 的 extend 方法为什么在类和实例上实现的逻辑不一致 at 2014年05月19日

    #4 楼 @lihaidong 没懂,能举个栗子不,foo(FooBar) 是如何插到 Object(Class) 和 Object(eigenclass) 中的?

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