Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
@reyesyang
VIP
NO. 25 / 2011-11-01

北京
6 Topics / 328 Replies
4 Followers
1 Following
533 Favorites
Pragmatic Programmer
GitHub Public Repos
  • blog-on-rails 1

    A blog application build with rubyonrails

  • wechat-universal-flatpak 0

    Flatpak 打包微信 Linux Universal 版

  • gnome-shell-extension-... 0

    Adds KStatusNotifierItem support to the Shell

  • xvm 0

    Version Management for more tools

  • LG-ultrafine-brightness 0

    A tool to adjust LG Ultrafine Series Monitor without Bootcamp in Linux and Windows.

  • playground 0

  • parser-study 0

  • spring-boot 0

    Spring Boot

  • clash-core 0

    backup of clash core

  • reyesyang.github.io-so... 0

    Blog source code based on Jekyll 3

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • Hello Ruby,走进琳达里优可丝的梦游仙境。 at July 09, 2013

    充满了爱的书,楼主也是在用绳名在翻译名字啊丝诺梨欧趴。👍

  • 在看《Ruby on Rails Tutorial》,不能登陆和退出。求解答! at July 08, 2013

    在 http://railstutorial-china.org/chapter8.html 页面中,也就是教程第八章里面已经提醒了已经存在的用户需要生成 remember_token,可以搜下面的内容:

    不过,如果你在浏览器中查看的话,网站还不能正常使用。这是因为“记住我”这个功能要求用户记录的记忆权标属性不为空,而现在这个用户是在 7.4.3 节中创建的,远在实现生成记忆权标的回调函数之前,所以记忆权标还没有值。为了解决这个问题,我们要再次保存用户,触发代码 8.18 中的 before_save 回调函数,生成用户的记忆权标:

  • 求助,head first rails 第四章的实验问题,应该有通用性问题! at July 08, 2013

    #5 楼 @bluetea 二楼也有笔误,应该是把 form_tag 前面的 <% 换成 <%=

  • 大家喜欢吃什么口味的方便面? at July 07, 2013

    #26 楼 @CharlesHuang 我陕西的

  • 大家喜欢吃什么口味的方便面? at July 07, 2013

    北京方便面,上初中时当早点吃

  • 求助,head first rails 第四章的实验问题,应该有通用性问题! at July 07, 2013

    #3 楼 @bluetea 二楼已经回答你问题了

  • 在看《Ruby on Rails Tutorial》,不能登陆和退出。求解答! at July 07, 2013

    你开发环境已经存在的用户生成了 remember_token 了吗?

  • 部署 ruby-china 遇到奇怪问题 at July 04, 2013

    是 bug, 论坛在修改密码逻辑在 AccountController 如下

    if resource.update_with_password(account_update_params)
    

    但是在 ApplicationCotnroller 中重写了 account_update_params 的实现,如下

    devise_parameter_sanitizer.for(:account_update) { |u| u.permit(*User::ACCESSABLE_ATTRS) }
    

    而 User::ACCESSABLE_ATTRS 中没有 current_password,这就导致 account_update_params 中的 current_password 始终被 Rails4 的 Striong Parameters 机制过滤掉。就出现了这样的问题。

    已经提交了 Pull Request,可参考 https://github.com/ruby-china/ruby-china/pull/189

  • KBC Poker2 at July 03, 2013

    #12 楼 @aisensiy 看了 18 楼才明白,poker II 上的方向键是通过组合键实现的。

  • KBC Poker2 at July 03, 2013

    #14 楼 @Teddy 我不是 Mac,不确定。如果你可以列几个快捷键的例子的话,我可以去同事的机器上给你确认下。

  • KBC Poker2 at July 03, 2013

    #13 楼 @freebird0221 这个倒是木有考虑。不过确实比较 poker II,pure pro 送的键冒也少的可怜,只有一个回车,poker 应该是送了 5 个

  • KBC Poker2 at July 03, 2013

    #12 楼 @aisensiy 木有太明白你的意思? : (

  • GoogleReader 为什么还能访问,心里不踏实 at July 02, 2013

    已经走了

  • 关于多对多条件查询 at July 02, 2013

    #2 楼 @hicupp 如果程序里没有需要查询另一个状态的需求的话,确实这样会更加简洁

  • KBC Poker2 at July 02, 2013

    #10 楼 @aisensiy http://kbtalking.cool3c.com/article/65538 最初考虑的也是 poker II,后来看到 pure pro 有方向键,所以就入了这个。60% 应该是相比全键盘键数比例吧。也不是很清楚,个人猜测。

  • KBC Poker2 at July 02, 2013

    KBT pure pro 飘过~

  • 关于多对多条件查询 at July 01, 2013

    直接在 where 中写条件,如果会多次使用的话,可以考虑添加 scope teacher1.students.where('student_teachers.mark = 0')

  • 还有高手给详细的解释下 caller [1..-1] 啊 at July 01, 2013

    caller 返回的是 array,所以接着 [1..-1] 仅仅是对数组的操作而已

  • 其实是一个 Padrino 的问题,请教下 at June 28, 2013

    http://www.padrinorb.com/guides/blog-tutorial#comment-126214233

  • 其实是一个 Padrino 的问题,请教下 at June 28, 2013

    那就是一个普通的 ruby 类名,你可以改,只要在 config/apps.rb 中 mount 时指定正确就可以了。

  • 其实是一个 Padrino 的问题,请教下 at June 28, 2013

    https://github.com/robbin/robbin_site/blob/master/app/app.rb

  • 其实是一个 Padrino 的问题,请教下 at June 28, 2013

    app/app.rb

  • 都来 show 一下自己的女朋友或者老婆吧! at June 19, 2013

    楼主是来拉仇恨的

  • OWASP Top 10 - 2013.pdf at June 14, 2013

    围观安全大师

  • 请教一个 ActiveRecord 关联关系的方法 at June 09, 2013

    #8 楼 @as181920 单表继承中 type 字段的赋值 Rails 会自己处理,算是 Rails 的魔法。具体可参考 http://poshboytl.iteye.com/blog/461623

  • Colourco.de - find your colour scheme at June 09, 2013

    给出了各种颜色格式,很实用啊。👍

  • An HTML5 Rich Text Editor Toolbar at June 09, 2013

    👍

  • 请教一个 ActiveRecord 关联关系的方法 at June 09, 2013

    试试这样:建立一个含有 type 字段的 resource 表,用来进行单表继承。分别派生出 ImageResource,VideoResource 等等用来在 Costomer 中设置 has_many :through 关联。我想应该就满足你的需求了。

    Migration:

    class CreateResources < ActiveRecord::Migration
      def change
        create_table :resources do |t|
          t.string :type
          t.integer :entity_id
          t.integer :customer_id
    
          t.timestamps
        end
      end
    end
    

    Model:

    class Resource < ActiveRecord::Base
      attr_accessible :customer_id, :entity_id, :type
      belongs_to :customer
    end
    
    class ImageResource < Resource
      belongs_to :image, foreign_key: 'entity_id'
    end
    
    class VideoResource < Resource
      belongs_to :video, foreign_key: 'entity_id'
    end
    
    class Customer < ActiveRecord::Base
      attr_accessible :name
      has_many :image_resources
      has_many :video_resources
      has_many :images, through: :image_resources
      has_many :videos, through: :video_resources
    end
    
  • Prev
  • 1
  • 2
  • …
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English