Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Rei
@Rei
管理员
第 1 位会员 / 2011-10-28

[email protected]
深圳
186 篇帖子 / 9147 条回帖
728 关注者
0 正在关注
11 收藏
中下水平 Rails 程序员
打赏作者
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**

  • asciidoctor-htmlbook 31

    Asciidoctor HTMLBook is an Asciidoctor backend for converting AsciiDoc documents to HTMLBook docu...

  • material-ui 17

  • htmlrenderer 12

  • rich-text-editor 12

  • rails-chatgpt-demo 8

  • rails-app 7

    A Rails project template lets me start new projects quickly.

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 为何 删帖 ,好霸气 at 2015年10月07日

    帮你举报 cc @lgn21st @huacnlee

  • 为何 删帖 ,好霸气 at 2015年10月07日

    #3 楼 @xiongmaojames 那你说你做了什么功课?

    Google 官方文档 看书

    你做完这三个功课还找不到我就告诉你。

  • 为何 删帖 ,好霸气 at 2015年10月07日

    问的问题太弱,官方文档明明有,自己一点功课不做。

  • 在 RailsGuides 里有个 Active Record Query Interface 的一个问题 at 2015年10月06日

    where(:orders_count => params[:orders].to_i)

  • 在 RailsGuides 里有个 Active Record Query Interface 的一个问题 at 2015年10月06日

    #4 楼 @zhaopei Mongoid 不支持这样写,"orders_count = ?" 是个 SQL 语句。

  • Rails 配置 webpack at 2015年10月06日

    #19 楼 @vkill browserify 可以用来作为 assets pipeline 和 npm 的桥梁,其他交给 assets。

    我只是看一下,没用上。

  • Rails 配置 webpack at 2015年10月06日

    #17 楼 @vkill 我觉得 browserify 更干净一点,和 Rails 集成也容易 https://github.com/browserify-rails/browserify-rails 。

  • Rails 配置 webpack at 2015年10月06日

    #12 楼 @vkill webpack 打包结果简直恐怖

    http://webpack.github.io/docs/tutorials/getting-started/#first-loader http://webpack.github.io/docs/tutorials/getting-started/first-loader/bundle.js

  • 使用了 Turbolinks,在微信里 title 不会更新,有解决方法吗? at 2015年10月06日

    判断微信浏览器关掉 Turbolinks。

  • 对于继承了 ActiveRecord::Base 来创建模型的类,想要修改对应字段的 set 和 get 方法 at 2015年10月05日
    write_attribute :password, generatePassword(password)
    

    密码 hash 不用自己写 http://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html

  • 。。。这算黑吗??? at 2015年10月02日

    多看点有意义的内容

    https://www.youtube.com/channel/UCWnPjmqvljcafA0z2U1fwKQ http://rubyweekly.com/

  • padrino 开发环境的局域网访问 at 2015年10月01日

    #4 楼 @lrbnew 那么你应该找类似的参数

    https://github.com/padrino/padrino-framework/issues/1522

    -h 0.0.0.0
    
  • padrino 开发环境的局域网访问 at 2015年10月01日

    -b 0.0.0.0

  • RubyConfChina 2015 大会主题介绍以及日程 at 2015年09月29日

    #5 楼 @jasl 上一年视频一直没有看到,希望今年能传 YouTube ……

  • RubyConfChina 2015 大会主题介绍以及日程 at 2015年09月29日

    有直播和录像吗?

  • ruby-china 是不是换服务器了 at 2015年09月29日

    https://ruby-china.org/topics/27506

  • 求学习 Ruby 的有效方法 at 2015年09月29日

    如果你学的是 Web 开发

    10 Ideas for Beginner Web Developers

    https://medium.com/code-thinking/10-ideas-for-beginner-web-developers-2f725aed08d5

  • 使用 message_bus 过程中,如新建订单获取到一条通知,居然会提示多次,问题出现在 message_bus.js 的回调函数调用了多次,如何解决? at 2015年09月29日

    不理解你为什么不接着上贴问,新开一个帖子上个帖子讨论的线索就丢失了。

  • Puppet Hacking Guide —— Puppet 的启动:子命令 at 2015年09月28日

    #14 楼 @fsword 考虑到口碑,目前好像只有 Amazon EC2 Container Service 可用。

  • 评论 Why I wouldn’ t use rails for a new company at 2015年09月28日

    #20 楼 @hjleochen https://aws.amazon.com/cn/autoscaling/

  • 按钮提交限制和一个 Rails 的问题,新手求救 at 2015年09月28日

    先写到页面里,如果多个地方要用再抽取出来。

  • 评论 Why I wouldn’ t use rails for a new company at 2015年09月28日

    #7 楼 @rubyu2 Matz 现在受雇于 Heroku(Salesforce 旗下),领导 Matz Team,这个团队用于专心开发推广 Ruby。所以 Ruby 有一个严肃的企业赞助商 Salesforce。

    https://www.new-bamboo.co.uk/blog/2011/07/12/translation-of-matz-q-a-article-after-joining-heroku/

    Mr Matsumoto (Matz going forward): When I last met Mr Marc Benioff (CEO of Salesforce.com) he asked me how he could support the development of Ruby.
    
    So I told him that I want to improve the situation which the majority of Ruby Core developers face, that they are either doing their work in their own spare time or they worry about their job security.  
    
    He said he could provide us some support and that’s why I decided to join Salesforce.com through Heroku (Note: Several members of Ruby Core are currently under negotiation to join Heroku).
    
  • dfdfar at 2015年09月27日

    正常来说,get 和 post 应该有两个 action:

    resources :users, only: [:new, :create]
    
    # 等同于
    
    get 'users/new', to 'users#new'
    post 'users', to: 'users#create'
    

    PS:如果你不用这种 Rails 默认的路由格式,就要在 form_for 加上 url 参数。

    def new
      @user = User.new
    end
    
    def create
      @user = User.new(params.require(:user).permit(...))
      if @user.save
      # ...
      else
        render :new
      end
    end
    

    此时表单页面文件名改为 new.html.erb。

    合在一个 action 也不是不可以,但不是 Rails 推荐的做法:

    def register
      if request.get?
        @user = User.new
      else
        @user = User.new(params.require(:user).permit(...))
        if @user.save
        # ...
        else
          render :register
        end
      end
    end
    

    更多路由知识看官方文档 http://guides.ruby-china.org/routing.html

  • dfdfar at 2015年09月27日
    get 'users/register'
    post 'users/register'
    

    这里把 get 和 post 都路由到同一个 action 了,get 访问的时候就调用 user_params,这时候 params 是空的。应该把 get 和 post 的 action 分开。

    PS:看的是什么书?

  • 有一个似乎是很常见的需求,但是没发现简洁优雅的实现方式:如何结束 ping x.x.x.x -t 命令? at 2015年09月27日

    是我就 ping -c 10 -W 1 算了。

  • dfdfar at 2015年09月27日

    Controller 的内容贴全,routes.rb 也贴出来。

  • dfdfar at 2015年09月27日

    照着书本写到这里的时候不动了。

    什么不动了?

    问题出在哪里?

    问题在哪里?

  • dfdfar at 2015年09月27日

    再把行号去掉,不然回答的人不能直接复制粘贴。

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