Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
adam.shen
@adamshen
高级会员
第 20859 位会员 / 2015-09-01

[email protected]
26 篇帖子 / 841 条回帖
81 关注者
53 正在关注
67 收藏
争取成为ruby圈一流段子手
GitHub Public Repos
  • rails_problem 5

    总结一些实现Rails常见需求所需要面对的问题

  • fetch_tieba 1

    贴吧爬虫

  • activestorage-aliyun 0

    Wraps the Aliyun OSS as an Active Storage service.

  • ruby-openai 0

    OpenAI API + Ruby! 🤖❤️ Now with ChatGPT and Whisper...

  • github-hosts 0

    通过修改Hosts解决国内Github经常抽风访问不到,每日更新

  • coding_mistakes 0

  • rspec-rails 0

    RSpec for Rails 5+

  • zxing_cpp.rb 0

    ZXing Ruby bindings for the ZXing C++ library.

  • git_flow 0

  • ruby 0

    The Ruby Programming Language [mirror]

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 弱弱问个问题: 如果将一个字符串作为变量? at 2015年12月24日

    我默默的告诉楼主一个可以实现的方法

    1.把你的 ruby 版本下降到 1.8

    2.在 irb 中使用,在 rb 文件里还是不行的。

    看这里

    I read from somewhere that now Ruby can't dynamically create local variable. Is it true or just a bug?

    The local variables are created in compile time, so that local variables that are defined in eval() cannot be accessed outside of eval. In 1.8, irb and tryruby does line by line compilation so that local variables are spilled from eval(), but in 1.9, it's strictly prohibited even under line-by-line compilation.

    matz.

    原因在这里

    In Ruby 1.8, all evals under a given scope (like, at the same scoped level in a method) used the same shared local variable scope. That scope grew as needed to accommodate new variables.

    In Ruby 1.9, every eval gets its own scope. This provides better isolation between evals, which has both positive and negative side effects. On the positive side, the code inside an eval can use a faster representation of local variables that doesn't depend on being able to grow. On the negative side, you can't do things like this anymore:

    在 1.8 之后,eval 创建的局部变量是在自己独立的 scope 下面的。

  • 这里有使用 Emacs 写 Ruby 的程序员吗? at 2015年12月24日

    #4 楼 @ywjno 这个真心不错,以前在 win 下写 C 的时候也用这个。

  • Write a TCP stack in Ruby at 2015年12月22日

    Awesome. I used to be a router software developer several years ago. I can't wait to play another protocol in ruby now.

  • Ruby 社区 发一个问题, 还被屏蔽关闭, 社区的管理这么管理 at 2015年12月22日

    楼主该不会是 python 社区派来的卧底?

  • 表单中 select 的 class 丢失了么 at 2015年12月22日

    这个:include_blank => true 用{}wrap 一下

  • 大家都怎么用 Ruby on Rails 写数据的查询功能 at 2015年12月22日

    #21 楼 @zerzerheart 如果不用 ajax,可以开启 Turbolinks,这样也可以没有换页效果。

    https://ruby-china.org/topics/17977

  • DHH 亲自给你演示, 如何用 Action Cable 做一个实时的聊天 app at 2015年12月22日

    哇,太酷了

  • 通过 ActiveRecord 访问原有的数据库, rails 如何连接 sqlserver 2008 at 2015年12月22日

    只是访问 sqlserver 数据的话,我用这个 https://rubygems.org/gems/tiny_tds

    查询数据的话在 Model 里写几个方法就可以了,如果想要用 ActiveRecord 的 Api,这个方法还不行。

  • 怎样管理 Linux / Mac 的配置文件 at 2015年12月22日

    我试了下在 unbuntu 下利用 mackup 配合金山快盘进行备份,发现金山快盘并不能自动同步隐藏的配置文件,需要用 tar 打包一下才能同步到服务器上。

    不知道 dropbox 是不是可以直接同步配置文件。

  • 怎样管理 Linux / Mac 的配置文件 at 2015年12月22日

    #15 楼 @hhuai 真心赞,自由度很高

  • RAILS API TO BE PART OF RAILS 5 at 2015年12月21日

    楼主猜得好对,--api 果然来了

  • 完美的 Ruby 图形验证码 Gem - RuCaptcha at 2015年12月21日

    收藏了,感谢楼主

  • Rails-5-0-beta1 at 2015年12月21日

    wa~

  • 有推荐一下好用的 Rails editor 吗? at 2015年12月21日

    #17 楼 @brucebot

    对啊,最喜欢这种简约的风格了.自己用最好了.国内的话,这么多劣质浏览器,适配还真是个问题.

  • 元编程 —— 装逼专用?(其实用 Rails,并不需要太高的 Ruby 技能) at 2015年12月18日

    如果是 Rails 项目,最好别用了.Rails 和 Ruby 是两回事,框架已经告诉你怎么去处理关键问题了.

    https://github.com/bbatsov/ruby-style-guide#syntax 这个里面关于元编程第一句话就是 Avoid needless metaprogramming.

    但是如果是自己写 Gem 就不一样了,黑科技想用就用,毕竟是自己独立面对一个复杂问题的解法.

  • 大家都怎么用 Ruby on Rails 写数据的查询功能 at 2015年12月18日

    #11 楼 @zerzerheart 时间段查询可以像楼上一样使用 Range,view 里用 select_data 就可以了。

    http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html

  • 大家都怎么用 Ruby on Rails 写数据的查询功能 at 2015年12月17日

    我的和楼上差不多,一般不另外做页面,直接在 index 里做过滤

    def index
      if params.has_key?(:user)
        params.require(:user).permit!(:name)
        @users = User.where(params[:user])
      else
        @users = User.all
      end 
    end
    
  • Masonry 插件的 at 2015年12月17日

    不上代码,不好判断啊

  • 有推荐一下好用的 Rails editor 吗? at 2015年12月17日

    #6 楼 @brucebot 哇 这个风格简直太喜欢了,看来我自己也用这个好了。

  • 一个奇怪的问题:RubyMine 下无法输入中文 at 2015年12月17日

    过了两年看这个贴子还真有意思.

    我现在用的是 Unbuntu14.04,RubyMine 版本 7.1.4,系统默认用的就是 fcitx,居然也存在这个问题.

    本来一直没有在意,因为只有 Erb 里面会用到一点点中文,但既然用 fcitx 可以兼容 swing,我不能使用中文输入法应该是别的原因,后来发现是因为在开启 Rubymine 的时候用了 sudo :<

  • DIY Ruby CPU 分析——Part I at 2015年09月26日

    rbkit 听起来像是又一个神器啊。

  • 查找文件创建时间-寻找解决方案 at 2015年09月24日

    看了下 ext3 是不支持的,ext4 才有。

    Dates recorded modification (mtime), attribute modification (ctime), access (atime), delete (dtime), create (crtime)

  • Nothing Is For Beginners at 2015年09月22日

    其实,正是因为 Beginner 才有一种,每天都能收获巨大的成长感,事情做到后面都会陷在瓶颈里,那时候只有靠意志了。

  • 这在 Rails 里也是默认的吗 (where 前没有 object)? at 2015年09月22日

    class method 调自己的 instance method,不用委托

  • 搜索了一下 Ruby on Rails 的 Google 趋势,图如下,大家怎么看? at 2015年09月22日

    Rails 本身的特点就是开发速度快,后端运行慢。

    总体上还是有需求的,我想很多创业公司宁愿多出几台服务器的钱,去换取项目快速上线的吧。

  • 为什么都说 Devise 很慢? at 2015年09月17日

    测试的场景能不能详细说一下。

  • 向社区的朋友推荐自己的书《Rails 实践》 at 2015年09月17日

    说声谢谢吧。楼主写得很好,推荐的书也都很不错。

  • 分析 Ruby 代码的执行环境 at 2015年09月16日

    总结得好,赞

  • 为什么服务端推送不如 websocket 出名? at 2015年09月12日

    学习了,stream.write 听来不错的样子。

  • Rails 项目 Gem 依赖的社交关系网络关系图及其生成 at 2015年09月12日

    确实麻烦,我一般用 RubyMine 直接 Go to define

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