Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Eric-Guo
@ericguo
VIP
NO. 1665 / 2012-03-31

[email protected]
天华建筑设计
上海
46 Topics / 1382 Replies
181 Followers
245 Following
75 Favorites
选Ruby是符合我爱钱爱金爱宝石气质的…
GitHub Public Repos
  • wechat 1331

    API, command and message handling for WeChat in Rails

  • wechat-starter 351

    WeChat web app with wx_pay in rails

  • tailwindcss-jit-stimulus 19

    A template with Rails 7.1, Shakapacker 7.2, TailwindCSS 3 and Stimulus 3.0

  • pgac_demo 13

    Rails 7.2 Action Cable chat room using AnyCable as backend

  • coreui4-rails-starter 12

    The CoreUI 4 Rails starter

  • product_hunt 5

    Demonstrate new Rails 5.1 feature: Assets on Yarn, System tests with Capybara and unified form_wi...

  • openproject 2

    OpenProject is the leading open source project management software.

  • dify-ruby-sdk 2

  • homeland 1

    :circus_tent: An open source forum/community system based on Rails, developed based on Ruby China.

  • ruby 1

    The Ruby Programming Language [mirror]

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 请教大家一个问题,Rails 怎么模糊查询 MySQL at December 05, 2015

    推荐参考一下railscasts-china

    class Episode < ActiveRecord::Base
      scope :by_tag, lambda { |tag_name| joins(:tags).where("tags.name = ?", tag_name) unless tag_name.blank? }
      scope :by_keywords, lambda { |keywords| where("REGEXP_LIKE(episodes.name, ?,'i')", "#{keywords.split(" ").join('|')}") unless keywords.blank? }
      scope :published, lambda { where(publish: true) }
    end
    
    class EpisodesController < ApplicationController
      def index
        @episodes = Episode.published.by_tag(params[:tag_id]).by_keywords(params[:query]).page(params[:page])
        respond_to do |format|
          format.html
          format.rss
        end
      end
    end
    
  • windows 下如何使用 nginx+puma 手动部署 rails 程序 at December 05, 2015

    #2 楼 @mumu 强的,我最多在 Windows 这边开发,你还在 Windows 这边部署,不过说实话,Windows 真的不是 Rails 部署的好环境,出了问题几乎找不到人问的。

  • Rails 中使用 bootswatch 遇到的问题 at December 05, 2015

    #19 楼 @leomustafa bootstrap 用的人那么多,不可能有这样的低级错误啦,你应该用bootstrap-sass,然后从bootswatch拷贝一份对应的已经调好的样式出来用。这两个才是官方 gems,支持最新 3.2.6。

  • 在 Windows 环境下安装 unicorn gem 包出错 at November 24, 2015

    #11 楼 @mumu 别慌,只是 warning。不过还是推荐 puma。

  • wechat-rails 微信 DSL for ruby at November 24, 2015

    #65 楼 @hlltc 那就需要调用material_list接口,得到 image 素材的命令是wechat material_list image 0 10,详细问题还是在wechat issues里面讨论吧。

  • The Pragmatic Bookshelf 的优惠码又来了 at November 24, 2015

    #8 楼 @lgn21st Jose Valim 的社区 credit 应该和 Yehuda 比较还是有差距,看你用 Elixir 做什么吧。。

  • The Pragmatic Bookshelf 的优惠码又来了 at November 24, 2015

    #5 楼 @seaify Sublime + Ember CLI Snippets

  • The Pragmatic Bookshelf 的优惠码又来了 at November 24, 2015

    Deliver Audacious Web Apps with Ember 2,9 美刀,便宜啊便宜!

  • 在 Windows 环境下安装 unicorn gem 包出错 at November 23, 2015

    Windows 推荐 puma,unicorn 从来就是不支持的。

  • Teahour.FM #81 和微软的爱恨情仇 at November 19, 2015

    #14 楼 @yzdel2000 好的,我错了,PHP 是最佳语言。。

  • 如何研究一个 Gem 包? at November 19, 2015

    #19 楼 @so_zengtao 多谢,这个 gem 确实入门不错,关键简单,但又不是太简单。。

  • Teahour.FM #81 和微软的爱恨情仇 at November 17, 2015

    #8 楼 @yzdel2000 确实 5.6 还是支持的,不过貌似 7.0 的确没有,对 PHP 不熟,只是随口一说,听众眼睛雪亮啊!

  • 准备着手翻译出版《Rebuilding Rails》,有人愿意买吗? at November 17, 2015

    买买买!

  • 关于 Rails 的动态模型,不重启服务器是不是不能更新呢? at November 13, 2015

    #7 楼 @yan32768 6 楼已经是正解,还有高手不是天天给你回答问题的,你这样说话很容易引起别人反感。

  • Rails 4 新项目的选择 2:前端框架 Simple_form 后台任务 搜索和用户认证 at November 08, 2015

    client_side_validations总算又活了,之前粗粗看过这个,感觉想用好很难,对开发者的 rails 和 coffee script 能力都有要求。

  • AJAX 使用 format.js 和 format.json 的区别以及问题 at November 07, 2015

    #3 楼 @chaucerling 当然不值得,不过现实的问题是先有了简单的页面 DOM 更新,然后你就会碰到复杂的,然后越搞越复杂,直到某一个点,你强烈的感到其实这已经是 SPA 了。。。

  • AJAX 使用 format.js 和 format.json 的区别以及问题 at November 05, 2015

    Rails 鼓励使用 format.js,因为渲染的 html 可以同后端共享,rails_ujs,turbolink 的支持也好。当然缺点也明显,前端后端不分离,完全的 Rails 解决方案绑定,后期不利于进行 micro-service 化。

    format.json 的话,必然搭配前端框架,ember 配ams其实是目前成熟度最高的,也是除了除了 format.js 最偏 rails 的,其实越是纯 json,对 rails 的依赖越少,其实用 rails 的意义就越小。

    format.json 对前端框架的选择,react-rails或者vue.js,目前是比较火的,但是就没有 ams 这样的 declative gems 了,一般都需要用 jbuilder 进行输出。

  • 「我们中出了一个叛徒」Shou.TV 从 Rails 切到 Go 了 at November 05, 2015

    应该恭喜才对,说明产品进入稳定期了。

  • 关于 Slim 模板的`=`标记的疑问 at November 02, 2015

    #2 楼 @hxygsh 就是写=> 后面会多加一个空格,看输出的页面很容易验证。

  • React vs Ember by Alex Matchneer at EmberNYC meetup at November 01, 2015

    #11 楼 @wppurking 两个框架都有优秀的地方,react-native毕竟 FB 也是敢想敢干啊,都学吧。。

  • 生产环境下,rake assets:precompile 后出现 TypeError: unknown filter type 错误 at November 01, 2015

    #2 楼 @zorajiang 其实应该使用这个分支:https://github.com/javyliu/rails_kindeditor,不过看起来这个编辑器好久没人更新了。。

  • React vs Ember by Alex Matchneer at EmberNYC meetup at November 01, 2015

    #2 楼 @aidewoode 同意,你的这篇vue.js 使用感受写的不错。

  • 在 Model 中使用 routes helper at October 30, 2015

    #5 楼 @billy 准确的说是 foo_url(@some_model),不过坑爹的是 url routes helper 无法在 model 里面使用。

  • Ruby 菜鸟代码拍砖 at October 29, 2015

    write 部分可以简化一点吧?

    def magic_change(file)
      # read file
      return unless File.exist? file
      original_string = IO.read(file, encoding: 'GBK').encode!('UTF-8')
      # deduplicate characters
      original_string = original_string.gsub(/([\S]{4,})\1/) { Regexp.last_match[1] }
      # write file
      File.write('b.txt', original_string, external_encoding: Encoding::UTF_16LE)
    rescue => error
      p error
    end
    
    magic_change ARGV[0]
    
  • 在 Model 中使用 routes helper at October 29, 2015

    #1 楼 @billy 还是有场景的,比如模型里面写发邮件的方法,邮件里面希望使用链接。

  • Volt 可以应用的生产环境吗? at October 27, 2015

    好像还不支持连接数据库?这样怎么用于生产啊。。

  • [上海][2015年10月27日] Ruby 聚会召集 at October 27, 2015

    @ibachue 的how-to-exec-shell-in-ruby 真不错,学到很多。

  • 新手关于 Ruby 的一个疑问 at October 26, 2015

    #1 楼 @although13 正解。

    [3] pry(main)> show-source File#open
    
    From: io.c (C Method):
    Owner: Kernel
    Visibility: private
    Number of lines: 36
    
    static VALUE
    rb_f_open(int argc, VALUE *argv)
    {
        ID to_open = 0;
        int redirect = FALSE;
    
        if (argc >= 1) {
            CONST_ID(to_open, "to_open");
            if (rb_respond_to(argv[0], to_open)) {
                redirect = TRUE;
            }
            else {
                VALUE tmp = argv[0];
                FilePathValue(tmp);
                if (NIL_P(tmp)) {
                    redirect = TRUE;
                }
                else {
                    VALUE cmd = check_pipe_command(tmp);
                    if (!NIL_P(cmd)) {
                        argv[0] = cmd;
                        return rb_io_s_popen(argc, argv, rb_cIO);
                    }
                }
            }
        }
        if (redirect) {
            VALUE io = rb_funcall2(argv[0], to_open, argc-1, argv+1);
    
            if (rb_block_given_p()) {
                return rb_ensure(rb_yield, io, io_close, io);
            }
            return io;
        }
        return rb_io_s_open(argc, argv, rb_cFile);
    }
    
  • 為什麼要 Bundle Update? at October 13, 2015

    #11 楼 @winstonyw 我就是天天 bundle update,但是,恩,恕我直言,感觉 deppbot 这门生意很难收到钱,因为无法帮助我了解每个 gems 的更改情况,升级了,我肯定还是会第一时间看 gem 的 changelog,然后按照相应指示改代码或者跑测试(实际上是开发时候顺便跑),总之,真的不觉得麻烦,还能顺便刷个论坛呢。。

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