Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Rei
@Rei
管理员
第 1 位会员 / 2011-10-28

[email protected]
深圳
182 篇帖子 / 9132 条回帖
727 关注者
0 正在关注
11 收藏
中下水平 Rails 程序员
打赏作者
GitHub Public Repos
  • writings 940

    [Closed] Source code of writings.io

  • alipay 732

    Unofficial alipay ruby gem

  • code_campo 291

    [Closed] Source code of http://codecampo.com

  • asciidoctor-pdf-cjk-ka... 101

    **no longer maintained**

  • asciidoctor-htmlbook 31

    Asciidoctor HTMLBook is an Asciidoctor backend for converting AsciiDoc documents to HTMLBook docu...

  • material-ui 17

  • rich-text-editor 12

  • htmlrenderer 12

  • rails-chatgpt-demo 8

  • rails-app 7

    A Rails project template lets me start new projects quickly.

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Rails 中怎么把字符串转化成 JSON Array at 2015年06月01日

    #6 楼 @wl1991724 是不是写了两重 to_json 了?render json: 就会自动调用 to_json。你用虚构的代码我看不出问题,正常 render json: models 就是输出 json。

    真实例子:

    https://github.com/rubygems/rubygems.org/blob/c3c9c7d1843a22dce9a934e669d0924f6d2246f5/app/controllers/api/v1/searches_controller.rb#L8

  • Rails 中怎么把字符串转化成 JSON Array at 2015年06月01日

    如果在终端输出,因为 json 是个字符串,所以两边就会加上引号。如果在浏览器输出,两边就没有引号,因为不需要。

  • Rails 中怎么把字符串转化成 JSON Array at 2015年06月01日

    #2 楼 @wl1991724 json 就是字符串啊。

  • Rails 中怎么把字符串转化成 JSON Array at 2015年06月01日
    array.to_json
    
    respond_to do |format|
      format.json { render json: array }
    end
    
  • 请问 如何验证 Model 中的 Hash? at 2015年06月01日

    要用校验应该平铺在 User Model 或者抽取成 AdditionInfo Model。

  • 部署 Heroku 报错:uninitialized constant Article::PictureUploader (NameError) at 2015年06月01日

    #6 楼 @killernova 你看链接。

  • 部署 Heroku 报错:uninitialized constant Article::PictureUploader (NameError) at 2015年05月31日

    #4 楼 @killernova https://github.com/killernova/blog/tree/master/app

    uploader 目录在哪?

  • 部署 Heroku 报错:uninitialized constant Article::PictureUploader (NameError) at 2015年05月31日

    uploader 目录没 check in

  • 使用 Rails 构建 API 实践 at 2015年05月31日

    👍 一个用 Rails 构建 API 的真实例子 https://github.com/rubygems/rubygems.org

  • 最近写的一个小 Demo, 发现最好的产品 at 2015年05月31日

    “发现并没有什么卵用” <- 我看到这句话很想删贴,正常说话不行吗?

  • 前端架构分享 at 2015年05月29日

    #18 楼 @luikore 流量很小还用不上这个技术。

  • 前端架构分享 at 2015年05月29日

    #16 楼 @luikore 没用过这个……

  • 前端架构分享 at 2015年05月29日

    我觉得用 Sprockets 好,现在有 browserify-rails(依赖 Sprockets 而不是 Rails),可以用前端喜爱的方式安装包和模块化。

    如果有特别需求,写成 Sprockets 扩展,现在社区大部份力量都集中在 Sprockets 上。

  • 类变量以及类实例变量会被 GC 么? at 2015年05月28日

    #9 楼 @victor 类变量不是被类引用吗?

  • 关于响应式设计的一个问题 at 2015年05月28日

    给移动端用不同的模版 http://guides.rubyonrails.org/4_1_release_notes.html#action-pack-variants

    但要有那么多精力维护两份模版才行。

  • Could not read gem at /Library/Ruby/Gems/2.0.0/ruby/2.0.0/cache/will_paginate-3.0.7.gem at 2015年05月28日

    #6 楼 @mexiqq 清除 gem 可以试试这些方法 http://stackoverflow.com/questions/8095209/uninstall-all-installed-gems-in-osx

  • Could not read gem at /Library/Ruby/Gems/2.0.0/ruby/2.0.0/cache/will_paginate-3.0.7.gem at 2015年05月28日

    估计是权限问题,gem 是在系统目录,bundle 也要加 sudo。

    不过我建议把 gem 目录改到用户目录,在 ~/.bashrc 或者 ~/.zsh(取决于你的 shell)添加以下配置:

    export GEM_HOME="$(ruby -rubygems -e 'puts Gem.user_dir')"
    export PATH=$GEM_HOME/bin:$PATH
    

    这样 gem 和 bundle 都不用 sudo 了。

    PS:一楼命令有错,应该是

    gem install will_paginate -v 3.0.7
    
  • Could not read gem at /Library/Ruby/Gems/2.0.0/ruby/2.0.0/cache/will_paginate-3.0.7.gem at 2015年05月28日

    执行一楼的命令的输出贴出来看看。

  • [已解决]Ruby 字符串的处理方法? at 2015年05月27日

    String#strip

  • [已解决]Ruby 字符串的处理方法? at 2015年05月27日

    Array#uniq

  • restful 路由能否限制只生成某些或者不生成哪些 at 2015年05月27日

    http://guides.ruby-china.org/routing.html#%E9%99%90%E5%88%B6%E7%94%9F%E6%88%90%E7%9A%84%E8%B7%AF%E7%94%B1

  • 如何定位 Puma + Nginx 部署问题 404 not found (on Ubuntu 14.04) at 2015年05月27日

    #4 楼 @caiqinghua 你搜索一下有没有 location @app 字段。

  • 如何定位 Puma + Nginx 部署问题 404 not found (on Ubuntu 14.04) at 2015年05月27日

    #2 楼 @caiqinghua 你没贴出来啊。

  • 如何定位 Puma + Nginx 部署问题 404 not found (on Ubuntu 14.04) at 2015年05月27日
    server {
        listen 80;
        server_name localhost;
    
        root /home/deploy/appname/public;
    
        try_files $uri/index.html $uri @app;
    
        location @app {
            proxy_pass http://app;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
        }
    
        error_page 500 502 503 504 /500.html;
        client_max_body_size 4G;
        keepalive_timeout 10;
    }
    
    1. 这段配置没加。
    2. 用这篇教程提供的 upstart 脚本启动 puma。
  • 如何优雅地将 CoffeeScript 写的 class 暴露给全局? at 2015年05月26日

    #1 楼 @billy coffee 不会。

  • 如何优雅地将 CoffeeScript 写的 class 暴露给全局? at 2015年05月26日

    coffee 官方文档推荐的就是挂到 window,如果要兼容 CommonJS 可以挂到 exports ? this,this 如果不用其它载入工具就是 window,然后 this 可以简写成 @,而且 class @Step 的写法也是可以的 ……看你喜欢哪种了,挂到 window 的方法没有问题。

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