Lydia's blog

Every day to be a little better


  • Home

  • Archives

  • Search

Capistrano 基本用法

Posted on 2019-04-20 16:35
  1. 安装gem
    gem ‘capistrano’, ‘2.12.0’
    gem ‘capistrano-rbenv’, ‘1.0.1’
    bundle
  2. capify .
    会生成两个文件: Capfile , config/deploy.rb
  3. cap deploy:setup 会建立必须的 文件夹 (眼疾手快 及时停止executing “if test -f /etc/debian_version; then echo debian; elif test -f /etc/redhat-release; then echo redhat; elif test -f /etc/system-release; then echo redhat; else echo unknown; fi;”)
  4. 到服务器上 shared目录下创建config 文件夹 里面创建secrets.yml database.yml. application.yml 文件并配置
  5. 执行bundle exec cap deploy
    Read more »

灵异现象汇总

Posted on 2019-04-19 17:19
  1. 在服务器上怎么precompile都不会生成新的assets 文件
    解决:RAILS_ENV=production放在命令后面
    https://stackoverflow.com/questions/22778784/rake-assetsprecompile-rails-env-production-not-working-as-required

  2. js click事件只监听一次就不再触发了
    解决: 因为使用的是封装好的dropdown 将他换成普通的隐藏/出现 就不会有问题了

微信打开网页 提示防诈骗

Posted on 2019-04-16 16:00

之前我们的网站一在微信里打开 输入的时候就会提示防诈骗 对用户来说体验很不好 找了很久配置的地方也没有找到 终于找到了 特此记录
设置位置

服务器调优-log分析工具

Posted on 2019-04-15 11:25

rails log(passenger log)

1
$ gem install request-log-analyzer

简单用法: 分析一个文件,并且把它输出到 report-for-logs.html 中:

1
$ request-log-analyzer cms_production_2013-02-17.log --format rails3 --output HTML --file report-for-cms-logs.html
Read more »

Mac ROR开发环境配置

Posted on 2019-04-05 22:32

为了导入数据库 调整了一个底层参数 给电脑调崩了 又要重新配置
特此记录配置文档

1.安装homebrew https://brew.sh/
2.安装pgsql

1
$ brew install  postgresql
Read more »

html-多行... 按照字数

Posted on 2019-03-30 13:22
1
<%= truncate(page.description, length: 70, omission: '...') %>

gem - imgkit 的坑

Posted on 2019-03-25 11:38

1.css js 文件都可以写在页面里但是必须配置config.asset_host = ENV[‘HOST’]否则会找不到文件
如果不能配置就只能将文件传到服务器然后指定全路径
2.有部分jquery方法不能用需要找到js方法代替
3.css filter 不可用

jquery-select2 highlight dropdown keywords

Posted on 2019-03-12 11:15

基本逻辑是在搜索的时候将query 存起来 然后用query.term在templateResult方法中拼接显示
matcher只能用于拼接文字什么的 html不行

Read more »

ios-notification

Posted on 2019-02-27 18:33

通知声明:

1
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(function_name) name:@"notification_name" object:nil];

接收通知:

1
[[NSNotificationCenter defaultCenter]postNotificationName:@"notification_name" object:self userInfo:nil];

ps: 一定要先addObserver 然后postNotificationName 否则会什么都调不到

rails - cache

Posted on 2019-02-25 16:26

View:

1
2
3
<% cache current_user.active_cvs.order('updated_at desc').first.updated_at do%>   
xxxxx
<% end %>

当cache后面的key变了的时候 页面中的内容才会重新加载

Controller:

Model:

1
Rails.cache.fetch()

ps: 开启development cache mode
rails dev:cache

参考

1…567…28

Lydia

This is lydia's blog

277 posts
1 categories
46 tags
© 2020 Lydia
Powered by Hexo
|
Theme — NexT.Muse v5.1.4