Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Rei
@Rei
Admin
NO. 1 / 2011-10-28

[email protected]
深圳
188 Topics / 9165 Replies
731 Followers
0 Following
11 Favorites
中下水平 Rails 程序员
Reward
GitHub Public Repos
  • writings 941

    [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**

  • geeknote 34

  • 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

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 大家是怎么测试 Rails 4 的 Strong Parameters 的? at July 12, 2013

    在 controller 里面的逻辑写 controller test

  • 如何在结果集中再次查询? at July 11, 2013

    #4 楼 @loveltyoic 可以把 params 这个参数传给 url helper,例如

    search_path(params.merge :new_colun => 'value')

    得出当前查询条件再加上新条件的地址。

    或者放在 js 做,这样查询条件区域可以缓存起来。

  • 如何在结果集中再次查询? at July 11, 2013

    数据量大了上搜索引擎,搜索引擎消耗也太大就把搜索结果按查询条件缓存。

  • 如何在结果集中再次查询? at July 11, 2013

    一般做法是在当前查询条件上再加查询条件,服务端根据新的条件再查一次

  • 调用外部程序要小心 at July 11, 2013

    #1 楼 @luikore 学习了,之前不知道有 shellescape 这个方法。

    我也是用 *%W,为了避免讲解语法所以用简单的数组。

    #3 楼 @huacnlee 好东西,检出几个潜在漏洞

  • 贵圈真乱 at July 11, 2013

    男女搭配干活不累,但我觉得这个不要低俗化,拍张男女平衡朝气蓬勃的合照就好了。

  • [南京] 暴走漫画招聘 rails 程序员 (内有无节操图,慎入) at July 11, 2013

    肯定是男孩子。

  • 关于 rails 版本的选择问题 at July 11, 2013

    跟着书学,社区 wiki 更新并不及时。

  • Mongoid 里的 includes 怎么是个陷阱? at July 11, 2013

    #5 楼 @hlxwell 这两个比较不对称,要比较的是 words 用 "list_id" => id 和 words "list_id" => {"$in" => [id]} 的差别,第二个语句没有查询 words。

  • Mongoid 里的 includes 怎么是个陷阱? at July 11, 2013

    #3 楼 @hlxwell 差了多少?

  • Mongoid 能否支持虚拟字段? at July 11, 2013

    是 to_json 处理。

    试试

    get do
      User.find(...).to_json(:methods => [:name])
    end
    

    我没用过 Grape,不知道是否正确。

  • Mongoid 里的 includes 怎么是个陷阱? at July 11, 2013

    MySQL 的 in 查询也不行,即使加了索引。所以这个问题最后要用 cache 解决。

    不过我也没做过严谨测试。

  • 如何实现 hit counter 功能 at July 10, 2013

    #5 楼 @cameo 简单实现可以用 mongodb 的 addToSet,mongoid 的 add_to_set,把 ip 存进去,然后计算数组长度。数据大了再做优化。

  • 如何实现 hit counter 功能 at July 09, 2013

    #3 楼 @cameo 奥,我搞错了,counter 是这个 https://github.com/nateware/redis-objects

    unique 是指针对哪个条件?

  • slim 出错,不知道什么问题了 at July 09, 2013

    td 前面一个空格,= 前面 5 个空格,都是不合法的。

  • 如何实现 hit counter 功能 at July 09, 2013

    Ruby China 的实现逻辑在这里 https://github.com/ruby-china/ruby-china/blob/master/app/models/mongoid/counter_cache.rb

    我做的话会直接调用 mongoid 的 inc 操作。http://mongoid.org/en/mongoid/docs/persistence.html

  • Rails4.0 + mongoid3.1.4 bundle 出错 at July 08, 2013

    参考 Ruby China 的 Gemfile https://github.com/ruby-china/ruby-china/blob/master/Gemfile

    除了 Mongoid 外还有相关的 *-mongoid gem 要升级,很多都只有 git,未发稳定版。

  • 有人用 Sublime Text 3 吗 at July 08, 2013

    #27 楼 @yunzifeiyu 1 年

  • 关于 belong_to 的问题 at July 08, 2013

    user.organization.organName

  • Turbolinks 后端逻辑分析 (更新总集篇) at July 08, 2013

    #37 楼 @Victor 可以用这个插件 https://github.com/kossnocorp/jquery.turbolinks

  • 发现个不错的论坛系统 at July 07, 2013

    http://ruby-china.org/topics/8628

  • sublime text 2 自动备份文件 at July 06, 2013

    保存到 Dropbox?Dropbox 每次修改都记录版本。本地保存的问题是保存再多的版本,硬盘挂了就都没了。

  • 为什么不再来一次? at July 06, 2013

    优秀的程序员不会在生产环境测试。

  • discourse 源码中,为什么一个页面 handlebars 一份,views 一份? at July 06, 2013

    看了历史记录还真是后加的 https://github.com/discourse/discourse/commits/master/app/views/categories/index.html.erb

    Show something on categories page when js is disabled

  • discourse 源码中,为什么一个页面 handlebars 一份,views 一份? at July 06, 2013

    给没有 js 的访问者看,比如搜索引擎。

  • 一个'五年'java developer 的现状 at July 06, 2013

    JavaZone2013 年度大片《Java 末日》预告片 http://www.aqee.net/javazone-2013-javapocalypse/

  • The Ћ Symbol at July 05, 2013

    好像在抬腿勾引

  • 关于 Rails 路由 at July 05, 2013

    这段参数是传给什么方法的?生成了什么内容?

    "menus" : [{
    "menuname" : "组织管理",
    "icon" : "icon-nav",
    "url" : "/organization/index"
    },
    
  • 关于 Rails 路由 at July 05, 2013

    #6 楼 @yuan_yp

    match ':controller(/:action(/:id))(.:format)'
    

    根据这条路由,"/organization/index" 指向的是 OrganizationController 的 index action。

    为什么 view 的 url 跟顶楼的不同?

    PS:你可以编辑顶楼内容看看怎么用 markdown 格式化代码。

  • 关于 Rails 路由 at July 05, 2013

    #4 楼 @yuan_yp 贴 routes.rb 内容

    你对 MVC 理解不清晰,浏览器的请求首先是到达 dispatch(route),然后指派给 controller 某个 action,action 查询所需的 model,然后 render view。猜你说的“请求在 view”层应该说是 view 里面加了个链接,但是对解决问题没有帮助,需要看 routes 和 view 的源码。

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