Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
陈若涵
@ruohanc
VIP
NO. 1454 / 2012-03-16

Alibaba-inc
杭州
33 Topics / 586 Replies
15 Followers
2 Following
44 Favorites
其实我是SA..正在学写代码...
GitHub Public Repos
  • ZhongHongHVAC 19

    Python driver for ZhongHong HVAC Controller

  • python_talk_2020 1

  • ruhoh_hosting_server 1

    Closed

  • wxcloudrun-django 0

  • home-assistant 0

    :house_with_garden: Open-source home automation platform running on Python 3

  • nextjs 0

  • aliyun-oss-python-sdk 0

    Aliyun OSS SDK for Python

  • cks_web 0

    给老爸写的简单网站

  • dotfiles 0

  • direnv 0

    Unclutter your .profile

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 今天发现一个以前没有注意到的好用的 ruby 语法,分享一下 at December 21, 2013

    warden 也用了 throw 和 catch.

    你可以在 rack 的 warden middleware 上层直接丢个 :warden 出来,然后 warden 就帮你返回 401 了

    https://github.com/hassox/warden/wiki/Overview#failing-authentication

  • [姨妈] 终于把 rvm 换成 rbenv 了 at December 21, 2013

    写了一个帖子讨论这个安装问题:rbenv system wide install (support for multi-user usecase)

  • Gitlab 是个好东西啊 at December 21, 2013

    #4 楼 @zeeler 嗯。我的意思就是说如果开发团队不大的话,肯定还是 gitlab 合适。

  • Gitlab 是个好东西啊 at December 21, 2013

    #7 楼 @bhuztez 公司大了你管不了别人的。邮件列表真的太小众,对素质素养的要求太高

  • PR 到 4 了 at December 21, 2013

    这是什么东东...

  • Gitlab 是个好东西啊 at December 21, 2013

    我感觉这是需求问题,Gerrit 目的是强制性的,精细化的 code review 吧?这方面 gitlab 还做不了呢。

  • [姨妈] 终于把 rvm 换成 rbenv 了 at December 21, 2013

    ok 基本搞定,Rbenv 系统级的安装,也解决了权限问题,使用了组权限。把需要完全控制 rbenv 的用户加入 rbenv 组就可以了

    GIST: https://gist.github.com/crhan/8064624#file-rbenv-install-system-wide-sh

    RBENV_PREFIX="/usr/local/rbenv"
    RBENV_GROUP="rbenv"
    
    ## Install rbenv
    git clone git://github.com/sstephenson/rbenv.git $RBENV_PREFIX
    
    ## Add rbenv to the path:
    echo '# rbenv setup' > /etc/profile.d/rbenv.sh
    echo "export RBENV_ROOT=${RBENV_PREFIX}" >> /etc/profile.d/rbenv.sh
    echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
    echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
    
    chmod +x /etc/profile.d/rbenv.sh
    source /etc/profile.d/rbenv.sh
    
    ## set rbenv group property
    groupadd $RBENV_GROUP
    chown -R :rbenv $RBENV_PREFIX
    sudo find $RBENV_PREFIX -type f -perm /100 -exec chmod g+x {} \;
    sudo find $RBENV_PREFIX -type f -perm /200 -exec chmod g+w {} \;
    sudo find $RBENV_PREFIX -type d -exec chmod g+rwxXs {} \;
    
    ## Install ruby-build:
    pushd /tmp
      git clone git://github.com/sstephenson/ruby-build.git
      cd ruby-build
      ./install.sh
    popd
    
    ## Install Ruby 1.9.2-p290:
    #rbenv install 1.9.3-p484
    #rbenv global 1.9.3-p484
    
    ## Rehash:
    #rbenv rehash
    
  • [姨妈] 终于把 rvm 换成 rbenv 了 at December 14, 2013

    #34 楼 @luikore 我对依赖没啥想管的。所以我觉得 autolib 帮我整的挺好的。然后嘛,你都自己编译好 ruby 了,已经比较违反使用工具管理的初衷了嘛,这是何以呀。

    继续问..理由 3 是啥意思..

  • 使用 omniauth-github 出现 Faraday::Error at December 14, 2013

    HTTP CODE 403: RFC2616

    10.4.4 403 Forbidden The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

    我没用过 omniauth-github, 但是你应该是填错字段了。403 说明通过了 authentication, 但是没通过 authorization

  • [姨妈] 终于把 rvm 换成 rbenv 了 at December 14, 2013

    我是从 rbenv 换到了 rvm.

    原因是自己用 rbenv 编出来的老是不能在 irb 里面输入中文,虽然知道其根本原因是使用了错误的 readline 库,但是一直都处理不好,一怒之下就换了 rvm.

    另外 rvm 良好的处理了多用户服务器环境下的管理。比如我用 root 安装 rvm 和 ruby, 但是用另一个普通用户运行 app 这种场景,rvm 能帮你搞定。而 rbenv 则需要你有一定的 SA 能力才能处理好。

    真正让我选择 rvm 的原因是:

    • 它有 offline 安装的方法,对我来说很重要,我有很多机器都不能上外网。
    • 有一个 binary 功能,可以让我自己打包一个适应本地环境的 ruby, 避免在每个服务器上编译

    再求教一下,列出的理由 2 和 3, 我其实没看懂。

  • [姨妈] 终于把 rvm 换成 rbenv 了 at December 14, 2013

    #31 楼 @jan 这个自作聪明是啥意思..?

  • 权限控制一般怎么做?比如帖子作者可以编辑、删除 at December 14, 2013

    #17 楼 @dddd1919 #16 楼 @saiga #15 楼 @huacnlee #14 楼 @jarorwar #13 楼 @allenfantasy

    最后,我用了 cancan. cancan 的文档各种齐全,各种辅助的方法也很完善,测试也很顺畅,而且完全兼容自定义的鉴权流程,另外也如 @saiga 所说,cancan 所不兼容 rails4 的功能确实用不到

  • API service 的开发 at December 11, 2013

    RocketPants 很好用,赞!

    就是文档不太全,得看源码才明白怎么用

  • 关于 rails.vim 和 janus 的小疑问? at December 01, 2013

    嗯...我 Rfind 和 Redit 也不能用,别的都好的。

  • [黑色星期五] 效率型工具 Manico 66% 折扣,现在仅 6 元人民币 at November 29, 2013

    果断支持主席!

  • Webrick 源码阅读笔记 at November 29, 2013

    👍

  • 权限控制一般怎么做?比如帖子作者可以编辑、删除 at November 29, 2013

    #11 楼 @jarorwar 额...我是因为最近是在选....还没想好用哪个。关于 cancan 不给的文章在 这里

    When upgrading an internal application to Rails 4, I discovered that CanCan does not play well with strong parameters. There are some patches to make things work, but they didn’t feel right. Also, CanCan hasn’t been given much love recently; it has the signs of an abandoned project: sporadic commits, many open issues/pull-requests, poor Code Climate score, etc.

  • 权限控制一般怎么做?比如帖子作者可以编辑、删除 at November 29, 2013

    有听说 cancan 逐渐失去维护,而且对 rails 4 支持并不好诶。

    pundit 有人试过这个么..

  • 请问有人遇到在内网开发时,rails 通过反向代理运行在 nginx 后端,调用 request.remote_ip 无法获取客户端 IP 或者报错吗? at November 15, 2013

    #10 楼 @zhangyuan 为啥觉得方向不对.? 你们直接给 real_ip_header 设置的是 REMOTE_ADDR 这个头.?

    Rails 和 Rack 都没有去取 X-Real-IP 头的代码。

    而且你如果就设置的是 REMOTE_ADDR 的话,会不会只支持一层代理转发?前端再加上一个 LB 会咋样..?

  • rails app 在 ssh 断开以后就打不开 at November 14, 2013

    楼主得描述一下你是怎么启动的 rails app

  • 请问有人遇到在内网开发时,rails 通过反向代理运行在 nginx 后端,调用 request.remote_ip 无法获取客户端 IP 或者报错吗? at November 14, 2013

    好吧..今天碰到跟楼主一样的问题。

    参考下 rails #5523

    • Rails 可以配置 config.action_dispatch.trusted_proxies
    • Rack 要在 initializers 里面给 Rack::Request#trusted_proxy?(ip)打 monkey patch
  • 客户端 API 开发总结 at November 14, 2013

    #45 楼 @jimrokliu 不太理解.......不止一个是啥意思..

  • 客户端 API 开发总结 at November 13, 2013

    讨教一下...开发 API 之后,认证咋整。

    • 当然不会上 oauth, 因为是内部应用,认证不在我这里,没这个条件
    • 希望可以防止 replay attack
    • 实现基于某个现有的标准,或者事实上的标准

    可供参考的例子不多

    • ruby-china 的 API, 直接用 Token 认证
    • gitlab API, 直接用 Token
    • api_auth, 满足需求,可是在 header 里面加了太多东西 (DATE & Content-MD5 & APIAuth), 感觉有点非主流。这样实现的问题是文档不好写,毕竟是给别人用的 API 的文档。
  • API service 的开发 at November 12, 2013

    @fredwu activeResource 好像不能自定义 API 签名啊.? 看起来只支持 Basic Auth 和 Digest. 但是我需要自定义签名,以防止 replay attack. 没找到怎么实现..

  • 不用插件怎么实现登录后动态跳转到登录前的链接 at November 03, 2013

    简化一下应该是这样.....

    class ApplicationController
      def authenticate!
        unless current_user
          session[:back_url] = request.uri
          redirect_to user_sessions_url
        end
      end
    end
    
    class UserSessionsController
      def new; end
    
      def create
        redirect_to(session.delete(:back_url) || root_url)
      end
    end
    
  • 不用插件怎么实现登录后动态跳转到登录前的链接 at November 03, 2013

    最近在学习 @Rei 大神的 writtings, 正好有这部分实现,你感受一下..

    1. user_session#new
    2. user_session#create
  • Rails 里面如何设计这个 association at October 26, 2013

    2.6 The has_and_belongs_to_many Association 2.8 Choosing Between has_many :through and has_and_belongs_to_many

    你问的就是这个吧..

  • 也没人集合一下啊,感觉都不认识 at October 25, 2013

    已到会场 - -...

  • 把 `vender/cache` 目录放入 git 仓库然后部署是最佳实践吗? at October 13, 2013

    #13 楼 @ZombieCoder 嗯..不过内网的网络确实是个问题...有些机房就是不给外网的...

  • 把 `vender/cache` 目录放入 git 仓库然后部署是最佳实践吗? at October 11, 2013

    #11 楼 @ZombieCoder - - errr...不是通过 bundle package 命令生成的嘛..?

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