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
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 开发环境 asset pipeline 如何实时更新? at 2011年12月17日
    # config/environments/development.rb
    config.assets.compile = true
    
  • 开发环境 asset pipeline 如何实时更新? at 2011年12月17日

    开发环境不 precompile 默认就是即时更新的

  • 外建关联 build 问题 at 2011年12月17日

    #5 楼 @Jsiguo 校验加 allow_blank => true

  • gem 安装发生的依赖包问题 at 2011年12月15日

    但是这个功能有时会失效 —— 有时会被墙

    不同版本的 rubygem 被墙时出错信息不同,比如:

    • 网络被断开
    • 无法解决依赖
  • 如何调试 ActionMailer at 2011年12月14日

    垃圾箱里面?

  • Rails 快速实现 markdown 和代码高亮 at 2011年12月14日

    html_safe 我感觉是不是误用了,如果 Text 内容是

    <script type="text/javascript">alert();</script>
    

    呢?

  • 大家有谁在用 Ubuntu 作为开发环境啊? at 2011年12月13日

    kubuntu

  • 求推荐空间 at 2011年12月12日

    #4 楼 @huobazi http://pages.github.com/#custom_domains

  • 求推荐空间 at 2011年12月12日

    The GitHub Pages feature allows you to publish content to the web by simply pushing content to one of your GitHub hosted repositories.

    http://pages.github.com/

  • 新手遇到 Action Controller: Exception caught,请教 at 2011年12月11日

    默认的 css 和 javascript 应该叫做 application.css 和 application.js,文件在 app/assets 下面的子目录可以找到,应该链接这两个

  • 新手遇到 Action Controller: Exception caught,请教 at 2011年12月11日

    #2 楼 @djks 感觉是 jquery-ujs 没触发,查看源码,把 html head 部分和这个 Destroy Comment 链接的 HTML 代码放出来看看

  • 问一个有点坑爹的安全问题 at 2011年12月11日

    你得到它了

    加密需要传输层加密,https

    防止机器注册可以用验证码之类的方式

  • 新手遇到 Action Controller: Exception caught,请教 at 2011年12月11日

    The action 'show' could not be found for CommentsController

    你访问了一个页面,路由映射到 CommentsController#show 方法,但是这个方法未定义

  • Rails Backend 的 Android/iOS 应用如何做注册登录? at 2011年12月11日

    什么年代的手机浏览器啊不支持 Cookiestore……

  • [豆知识] RESTful JSON API 接口应该 POST 什么数据 at 2011年12月11日

    #3 楼 @hooopo 哦,原来还有这参数,那是 json 好。

    附送 JSON 编码

    > JSON.stringify({a:1, b:[1,2,5], c: 'test"'})
    "{"a":1,"b":[1,2,5],"c":"test\""}"
    
  • [豆知识] RESTful JSON API 接口应该 POST 什么数据 at 2011年12月11日

    #1 楼 @hooopo 试了下,Rails 可以处理 Content-Type: application/json

    curl localhost:3000 -XPOST -d '{"a":1, "b":2}' -H "Content-Type: application/json"
    
    Started POST "/" for 127.0.0.1 at 2011-12-11 17:23:01 +0800
      Processing by HomepageController#index as */*
      Parameters: {"a"=>1, "b"=>2, "homepage"=>{"a"=>1, "b"=>2, "controller"=>"homepage", "action"=>"index"}}
    

    不知道后面的 homepage 是怎么回事。服务端处理的时候那个 as / ,应该说明了返回格式跟 Content-Type 无关(跟 Accept 以及 params 中的 format 有关)

    application/x-www-form-urlencoded 是一些 Http 库的默认行为,比如 Rest-client、JQuery Ajax,用起来比较方便,不然还得教客户端编写者怎么指定 Content-Type。

  • 如何在 routes.rb 中忽略掉一个 route,使其不被 routes.rb 中的规则匹配到? at 2011年12月08日

    #3 楼 @iBachue 抱歉,我也是道听途说,刚测试了一下,依然无法捕获

    https://github.com/rails/rails/issues/671

    看后面讨论似乎是不打算修复了,依然需要那条路由。

    然后回到主题,omniauth 运行在 rack 层,应该不会被 route 里面的规则影响阿。

    $cd ruby-china
    $rake middleware
    use ActionDispatch::Static
    use Rack::Lock
    use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000003bbfa50>
    use Rack::Runtime
    use Rack::MethodOverride
    use Rails::Rack::Logger
    use ActionDispatch::ShowExceptions
    use ActionDispatch::RemoteIp
    use Rack::Sendfile
    use ActionDispatch::Reloader
    use ActionDispatch::Callbacks
    use ActionDispatch::Cookies
    use ActionDispatch::Session::CookieStore
    use ActionDispatch::Flash
    use ActionDispatch::ParamsParser
    use ActionDispatch::Head
    use Rack::ConditionalGet
    use Rack::ETag
    use ActionDispatch::BestStandardsSupport
    use Warden::Manager
    use Rack::Mongoid::Middleware::IdentityMap
    use OmniAuth::Strategies::GitHub
    use OmniAuth::Strategies::Twitter
    use OmniAuth::Strategies::Douban
    use OmniAuth::Strategies::OpenID
    run RubyChina::Application.routes
    

    最后才到 Route::Application.routes

    如果真的不行,把 404 路由改成

    match '*path' => 'home#construction', :constraints => { :path => /^(?!auth).*/ }
    
  • 如何在 routes.rb 中忽略掉一个 route,使其不被 routes.rb 中的规则匹配到? at 2011年12月07日

    rack 处理比 route 要前,应该不会被路由规则干扰阿。

    然后处理 404 应该用 rescue_from(曾经某个版本的 rescue_from 不能正确处理路由缺失,现在已经好了)

  • 除了 state_machine 还有没有更好的? at 2011年12月06日

    不过我印象中,只要涉及 3 个或以上状态的,不用状态机管理都会慢慢变得不可管理……建议还是上状态机

  • 除了 state_machine 还有没有更好的? at 2011年12月06日

    #6 楼 @huacnlee state_machine 强项是状态转移,如果没有转移的需求的话可以用一个 symbol array 做状态的允许值,I18n 直接翻译这个 symbol 行了

  • 除了 state_machine 还有没有更好的? at 2011年12月06日

    aasm 依赖 activerecord,out transitions 已经不维护了,out workflow 看起来不错,单文件代码很少,求经验 state_machine 代码最复杂,不过用户最多,功能最全(比如多个状态字),我用的话还是用这个。

  • 除了 state_machine 还有没有更好的? at 2011年12月06日

    https://www.ruby-toolbox.com/categories/state_machines

  • Mongoid & Kaminari query in view at 2011年12月05日

    #3 楼 @doitian Mongoid 的 all 还是返回 Mongoid::Criteria

  • Mongoid & Kaminari query in view at 2011年12月05日

    哦,是我没理解 @xdite 的意图。我也做个测试看看。根据评论所说,是 eval 导致速度慢。


    我在页面加了个查询,没感觉有啥差异

  • 感觉这个盛大的云服务器运行起来有点慢阿 at 2011年12月05日

    #4 楼 @siuying 备案未完成,域名不能直接指向国内服务器

  • Mongoid & Kaminari query in view at 2011年12月05日

    就是这样啦,所谓不要 Query in view 是指逻辑,不是执行。

    rails 3.1 的 stream 正需要延迟查询。在 action 里面 execute 不会使速度边快,只是查询耗时从 view 里面移到 action 而已。

  • 用 jekyll 和 Octopress 做博客的都进了分享一下哈 at 2011年12月05日

    我打算自己写

  • 不知道大家都建议哪种 mongodb 的 mapper at 2011年12月05日

    #7 楼 @soloara 不要激将法。告诉你 mongoid 好在哪里也只是五十步而已。网上很多 mongoid vs xxx 的文章。

  • 不知道大家都建议哪种 mongodb 的 mapper at 2011年12月05日

    Mongoid

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