摘要: 错误信息: 在docker中运行es时,默认启动sniffing 模式,es自动查找节点, 要确保Elasticsearch返回可从容器外部访问的IP地址。 解决方式为关闭sniffing或者配置es返回的主机地址,参考 https://github.com/olivere/elastic/wiki 阅读全文
posted @ 2018-11-06 10:01 小芬喵 阅读(3323) 评论(0) 推荐(0) 编辑
摘要: 我在查看 Array 类和 Hash 类的祖先链的时候都发现了 Enumerable,说明这两个类都mixin了Enumerable模块。Enumerable模块为集合型类提供了遍历、检索、排序等方法(collect、map、each_with_index等),该模块的方法都用到了 each ,因此 阅读全文
posted @ 2018-08-01 17:49 小芬喵 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Active Record 验证辅助方法的默认错误消息都是英文,为了提高用户体验,有时候我们经常会被要求按特定的文本展示错误信息。此时有两种实现方式。 1. 直接在:message添加文案 验证一下: 2. 使用 rails国际化API 在config/locales文件下已经存在一个默认的en.y 阅读全文
posted @ 2018-07-23 17:53 小芬喵 阅读(260) 评论(0) 推荐(0) 编辑
摘要: package main import "fmt" func main(){ var arr = [] int { 9 , 6 , 2 , 5 , 8 , 10 , 12 , 1 } var new_arr [] int new_arr = sortArr( arr , len( arr ) ) fmt.Printf("%d ", new_arr) } ... 阅读全文
posted @ 2018-07-13 14:28 小芬喵 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 原文:http://jetbrains.license.laucyun.com/ Working Server http://jetbrains.license.laucyun.com (Lower of 2017.3) http://52.13.243.210:8000 (All version, 阅读全文
posted @ 2018-07-13 10:58 小芬喵 阅读(862) 评论(0) 推荐(0) 编辑
摘要: 在生产环境执行rails console没反应无法进入控制台,或者执行rails console的时候spring自动启动,导致所有的类名都无法识别,报错:NameError: uninitialized constant ClassName 。 快速解决方式: 正常流程: 1. 在Gemfile中 阅读全文
posted @ 2018-06-28 14:29 小芬喵 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 应用场景:更新系统操作记录时,记录操作人即当前登录用户 方法一:在线程中添加一个变量 方法二:在model中添加一个类变量 阅读全文
posted @ 2018-05-17 18:02 小芬喵 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 系统重构或升级时偶尔会碰到需要重写某个字段的情况,例如: 1. 读取user的name字段时,实际返回name_new字段 2. 修改属性时做一些其他操作(这种场景也可以使用回调来实现) 阅读全文
posted @ 2018-05-17 17:39 小芬喵 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 1.修改Gemfile bundle install 2.生成附件 export.rb 3.发送邮件 export_mailer.rb 阅读全文
posted @ 2018-04-25 15:09 小芬喵 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 参考:http://www.zslin.com/web/article/detail/73 1.安装 sudo apt-get install nginx 2.配置: http_demo.conf 代理https需要配置对应域名的ssl证书 https_demo.conf listen 443:表示 阅读全文
posted @ 2018-04-25 13:37 小芬喵 阅读(2666) 评论(0) 推荐(0) 编辑