Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
@allenwei
高级会员
第 366 位会员 / 2011-12-02

[email protected]
西安
10 篇帖子 / 299 条回帖
5 关注者
0 正在关注
1 收藏
GitHub Public Repos
  • Postgresql-Web 5

    A web interface of Postgresql for Rails

  • sidekiq-rollbar 5

    Report exception to Rollbar

  • bull 1

    Premium Queue package for handling distributed jobs and messages in NodeJS.

  • JSON-encode-benchmark 1

    JSON encode benchmark across Ruby, JRuby, NodeJS, Go

  • representable 1

    Maps representation documents from and to Ruby objects. Includes XML and JSON support, plain prop...

  • redmine-cookbook 1

    An OpsCode Chef cookbook for Redmine.

  • mask 1

  • mjml-utils 1

    The utility belt for MJML developers

  • graphql-code-generator 0

    GraphQL code generator with flexible support for custom plugins and templates

  • react-native-elements 0

    Cross Platform React Native UI Toolkit

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Rails 3.1 的 assets 该如何安排? at 2012年02月16日

    我的做法是 需要 precompile,外部访问的的东西放在 app/assets 共用的放在 lib/assets 第三方的放在 lib/assets

    这样在设置 precompile 的时候只要设置成 app/assets 里面的 js 和 css 就好了

  • grape 写 api 发送文件 at 2012年02月09日

    @yakjuly 这个不知道是不是可以 send_file(file, :disposition => 'attachment', :filename => File.basename(file)

    我已经放弃用 Grape 了,还是原生 Sinatra 用着放心

    现在的方案是 Sinatra + Roar https://github.com/apotonick/roar

  • 你使用 gemset 吗? at 2012年02月06日

    不要把.rvmrc 放到 git 里,麻烦就少点了,每个人用自己的

  • 有没有程序员使用的 ppt 模版 at 2012年02月06日

    试试这个 https://github.com/bartaz/impress.js demo http://bartaz.github.com/impress.js

  • 做一个 iOS 和 Android 的 api server,用 ruby 的什么库比较好? at 2012年02月03日

    推荐直接用 Sinatra

  • 请问 ruby rails 中,realtime 功能有什么工具可以做?都用 faye 吗? at 2012年02月03日

    Juggernaut 挺好用的 https://github.com/maccman/juggernaut

  • 有木摄影爱好者推荐个入门单反 at 2012年01月31日

    #12 楼 @iceskysl 我的 D5000 就没怎么用,放着当摆设,改天赶紧卖了去

  • ActiveRecord unscoped 一定要用 block 的写法? at 2012年01月30日

    #1 楼 @poshboytl Article.unscoped.all 和 Article.unscoped 是一样的,而且unscoped后面跟scope的话也会被缓存住

  • MacOS Lion 不能通过局域网 ip 连接访问本地 Rails server [已解决] at 2012年01月19日

    #7 楼 @zhangyuan 果然,绑定到 0.0.0.0 就好了,长见识了 顺便贴上我启动 sinatra 的命令,用 shotgun 启动的 shotgun -o 0.0.0.0

  • MacOS Lion 不能通过局域网 ip 连接访问本地 Rails server [已解决] at 2012年01月19日

    #10 楼 @yedingding tcp4 0 0 .3000 *. LISTEN

  • ror 是否适合开发 Enterprise Service API ? at 2012年01月18日

    可以用轻量级的 sinatra 做 API

  • 分享一个 attr_accessor 的技巧 at 2012年01月18日

    都定义了 getter 和 setter 还需要attr_accessor么?

  • MacOS Lion 不能通过局域网 ip 连接访问本地 Rails server [已解决] at 2012年01月18日

    #1 楼 @alvin2ye 你指的是/etc/hosts么?ip 地址还需要绑定么?

  • MacOS Lion 不能通过局域网 ip 连接访问本地 Rails server [已解决] at 2012年01月18日

    #2 楼 @richfisher 确定 ip 是正确的

  • (已解决) 每天 500w 条 log 如何入 mysql 库比较靠谱 at 2012年01月14日

    mysql load 应该是最快的吧,把 mysql 引擎换成 ISAM 在 load 试试,应该会快点 或者直接上 hadoop, hive 吧

  • 怎么在 Grape 中集成 Devise 的验证? at 2012年01月10日

    #11 楼 @qichunren 没帮到你,最近比较忙,改天有时间,我写个 demo 出来

  • 怎么在 Grape 中集成 Devise 的验证? at 2012年01月10日

    #8 楼 @qichunren 在 warden.logout 后面加一行 warden.params[:controller] = "sessions" 试试

  • 怎么在 Grape 中集成 Devise 的验证? at 2012年01月10日

    #8 楼 @qichunren 不知道具体的问题是什么,我也是看了半天源码研究出来的,你可以再看看 warden 的代码 `

  • 怎么在 Grape 中集成 Devise 的验证? at 2012年01月10日
    1. 加一个 devise 的 module token_authenticatable
    2. 加一个 before filter 到 user model, before_save :ensure_authentication_token, 这个是 devise 提供的 3.在 devise 的 initializer 里面加入 config.token_authentication_key = :single_access_token
    3. 定义一些 helper
    helpers do
      def warden
        env['warden'].params[:single_access_token] = env["HTTP_X_USER_ACCESS_TOKEN"]
        env['warden']
      end
    
      def current_user
        @current_user ||= env["HTTP_X_USER_ACCESS_TOKEN"].nil? ? nil : User.find_by_authentication_token(env["HTTP_X_USER_ACCESS_TOKEN"])
      end
    
      def authenticate!
        unless current_user
          logger.debug "authenticate fail with HTTP_X_USER_ACCESS_TOKEN #{env['HTTP_X_USER_ACCESS_TOKEN']} "
          raise_401
        end
      end
    end
    
    1. 定义一个 api,让用户得到 token post "/login" do warden.logout if user = warden.authenticate(:scope => :user) user.ensure_authentication_token! {:user => {:display_name => user.display_name, :single_access_token => user.authentication_token, :updated_at => user.updated_at, :id => user.id }} else raise_401 end end
  • 鼓捣一下更快速的 model unit tests at 2012年01月10日

    我的做法是,把一些方法写入 module, 写一个不 load rails enviroment 的 rspec_helper

  • 怎么在 Grape 中集成 Devise 的验证? at 2012年01月09日

    我是用 devise 的 single access token, 做 xAuth

    devise  :token_authenticatable
    
    config.token_authentication_key = :single_access_token
    

    然后拿客户端传入的 env['HTTP_X_USER_ACCESS_TOKEN'] 和 devise 的 authentication_token 做比较

  • 哈哈哈,上 Ruby 官方网站了 at 2012年01月04日

    靠谱!

    右面的 SketchUp 中文门户 http://www.sketchupbar.com 是什么东西

  • 聊聊自己的编程强迫症吧~.~ at 2012年01月04日

    看到

    STATUS = ["a", "b","c"]
    

    都要改成

    STATUS = %w[a b c]
    
  • 用 RSpec 的看看这个: ChuckTestar at 2011年12月03日

    #2 楼 @fredwu 这音乐配的

  • 中文 Railscast 第一期上线 at 2011年12月02日

    @poshboytl 强烈支持啊,很早之前我也和同事商量过做中文 Railscast 的想法,我们给公司内部做过一个,后来就不了了之,话说做视频真的很花时间,像你做的这么流畅的肯定话了不少时间

    加油!!

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