Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
最初的模样
@aoner
高级会员
第 3489 位会员 / 2012-08-30

成都
4 篇帖子 / 109 条回帖
4 关注者
2 正在关注
146 收藏
GitHub Public Repos
  • qiniu_rails 0

    Qiniu backend for Activestorage, with QiniuHelper for independent use and sprockets support

  • activestorage-aliyun 0

    Wraps the Aliyun OSS as an Active Storage service.

  • kemal 0

    test

  • crecto 0

    Database wrapper and ORM for Crystal, inspired by Ecto

  • qy_wechat_api 0

    企业微信高级API Ruby版本

  • bestpay 0

    翼支付交易接口

  • yol_qy_weixin 0

  • IMGKit 0

    Uses wkhtmltoimage to create JPGs and PNGs from HTML

  • FileSaver.js 0

    An HTML5 saveAs() FileSaver implementation

  • homeland 0

    :circus_tent: An open source forum/community system based on Rails, developed based on Ruby China.

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Active Storage 的正确使用姿势 at 2024年05月17日

    这个不太好设置阿里云的媒体处理的触发器,设置成全部图片也在转码,前缀也不行,key 根本没规律可言;后缀也不行,上传的文件根本没后缀

  • 给 activestorage 顺手撸了个七牛的 service at 2024年04月28日
    activestorage.source.js:651 
    PUT http://up-z2.qiniu.com/mkblk/20110227 400 (Bad Request)
    POST http://up-z2.qiniu.com/mkfile/20110227/key/XXXXXXXXXXXX 400 (Bad Request)
    

    直传好像有问题,原先的 xhr 会重复发送

  • Rails 5.2 新功能详解 at 2019年11月15日

    @lyfi2003 rails5.2 中 lock! 的机制有变化,导制以前正常的代码,时不时的出现(不是每次都出现),以什么办法兼容吗

    RuntimeError (Locking a record with unpersisted changes is not supported. Use `save` to persist the changes, or `reload` to discard them explicitly.)
    
  • RoleCore —— 快速构建定制化的 RBAC 系统 at 2019年11月11日

    @jasl 嗯,我刚也试了,在 5.2 下正常,感谢🍻

  • RoleCore —— 快速构建定制化的 RBAC 系统 at 2019年11月11日

    @jasl 我的 ruby 版本是 2.5.1 rails5.0.7.2

  • RoleCore —— 快速构建定制化的 RBAC 系统 at 2019年11月11日

    @jasl 用的是 role_core,和你 dummy 唯一不同的地方就是我没用 cancancan

    def create
        @role = Role.new(role_params)
    
        if @role.save
          redirect_to roles_url, notice: "Role was successfully created."
        else
          render :new
        end
      end
    
    # Only allow a trusted parameter "white list" through.
      private def role_params
        params.require(:role).permit(:name, permissions_attributes: {})
      end
    
  • RoleCore —— 快速构建定制化的 RBAC 系统 at 2019年11月11日

    @jasl 照着你的那个例子自己写的

  • RoleCore —— 快速构建定制化的 RBAC 系统 at 2019年11月11日

    @jasl 这样编辑权限的时候好像没生效

    Parameters: {"utf8"=>"✓", "authenticity_token"=>"w0o9CGy+oR9bqZaPpmglcNnKrzRS+e7/LFTZOPePAOWrHHwbuMABqzolmhB3u0vVUSRSPqs77BwKHKU8iObC+Q==", "role"=>{"name"=>"j", "permissions_attributes"=>{"task"=>{"create"=>"1", "destroy"=>"0", "update"=>"0", "update_my_own"=>"1", "destroy_my_own"=>"1"}, "production"=>{"create"=>"1", "destroy"=>"0", "accept"=>"0", "read"=>"1", "read_public"=>"0"}, "topic"=>{"create"=>"1", "destroy"=>"1", "accept"=>"1"}}}, "commit"=>"Update Role", "id"=>"7"}
      Role Load (0.5ms)  SELECT  `roles`.* FROM `roles` WHERE `roles`.`type` IN ('Role') AND `roles`.`id` = 7 LIMIT 1
    Query Trace:
          app/controllers/roles_controller.rb:47:in `set_role'
    Unpermitted parameters: task, production, topic
       (0.9ms)  BEGIN
      SQL (2.0ms)  UPDATE `roles` SET `permissions` = NULL, `updated_at` = '2019-11-11 16:52:40' WHERE `roles`.`id` = 7
    Query Trace:
          app/controllers/roles_controller.rb:32:in `update'
       (2.8ms)  COMMIT
    
  • RoleCore —— 快速构建定制化的 RBAC 系统 at 2019年11月11日

    @jasl 这个地方参数要怎么设置,手动一个一个指定吗?

    # Only allow a trusted parameter "white list" through.
      private def role_params
        params.require(:role).permit(:name, permissions_attributes: {})
      end
    
  • [ruby 大会门票抽奖] 语言痴人松本行弘,把编程当做一生的事业 (友好速搭致敬 ruby 之父) at 2019年08月23日

    下单成功,等待签收😀 😀

  • 推荐一个简单有效的减肥方法:生酮饮食 at 2019年01月22日

    还是运动好,跑步半年,完全没有控制饮食,瘦了十二斤

  • 关于腾讯 API 拼 URL 的服务 at 2018年12月20日

    没试,纯猜

    RestClient.post('http://example.com/resource',
                              {foo: 'bar'},
                              {content_type: "application/application/x-www-form-urlencoded"})
    
  • Ruby China 7 岁生日快乐 at 2018年10月29日

    👏 👏 👏 👏 👏 👏 👏

  • 如何获取文章第一段里面的文字并且最多只能取前 150 个字符 at 2018年07月27日

    strip_tags 过滤所有 html 标签

  • 求助各位大神。 at 2018年07月16日

    @Nekor 格式合法在执行 to_date 嘛

    2.5.1 :009 > "2018-02-30".to_date
    Traceback (most recent call last):
            1: from (irb):9
    ArgumentError (invalid date)
    
  • 求助各位大神。 at 2018年07月16日

    /(^(\d{4})[-\/]{1}(\d{1,2})[-\/]{1}(\d{1,2})$)/ 简单粗暴,只能判断格式是否正确

  • 如何优雅的在 rails 动态的添加表单项目 at 2018年04月28日

    cocoon

  • 能否给页面底部一个背景色,比如白色,会好看很多 at 2017年10月18日

    这不是微博

  • 并发,多线程引起的问题? at 2017年08月23日
    money_record = MoneyRecord.new
    money_record.transaction do
      money_record.save!
      account.lock!
      account.balance += money_record.money
      account.save!
    end
    

    直接累加就好了,不用每次求和吧

  • 在使用 Ruby 或者 Rails 的过程中,你遇到过哪些令你印象深刻的坑? at 2017年03月10日

    redis-object 的 lock 与 activereocrd 的 lock 命名冲突,使用 with_lock 就悲剧了

  • Redis-objects 介绍 at 2017年03月09日

    redis-object 的 lock 和 rails 的 lock 命名冲突,比如 User.lock.find(1),本意是使用数据库的行级锁,这时调用的确是 redis-object 的 lock

  • Elixir 官网 Guides 全部中文翻译 at 2016年08月07日

    好人卡 +1👏

  • 建议去掉登录验证码 at 2016年07月20日

    现在市面上绝大多数的锁都能轻易被打开,你家就不装锁了吗?

  • RubyConf China 2016 赞助征集 at 2016年06月29日

    家门口了,不参加说不过去👏

  • [成都] OneStopWareHouse 招聘中级 Rails 全职 1 名 at 2016年06月22日

    👏 👏 👏

  • [结束] 送几本《Docker 即学即用》 at 2016年02月19日

    aoners@gmail.com

  • 完美的 Ruby 图形验证码 Gem - RuCaptcha at 2016年01月04日

    @huacnlee grape 里使用 RuCaptcha 吗

  • 还是一个基础问题。 有没有一个漂亮的写法实现这段代码? at 2015年09月01日

    #8 楼 @huacnlee 一直这么写,感觉更方便阅读

  • 征集大家意见,关于回帖用树形方式展示,类似 HackerNews at 2015年08月10日

    👎

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