@awking 斗鱼直播要吗?
纯粹灌水,尽量无视
随意冒个泡~~
# components
//= require jquery/dist/jquery
//= require jquery.lazyload/jquery.lazyload
//= require jquery.turbolinks/src/jquery.turbolinks
//= require jquery-ujs/src/rails.js
//= require lodash/lodash
//= require moment/moment
//= require moment/locale/zh-cn
//= require handlebars/handlebars
//= require jquery.remotipart
//= require nprogress/nprogress
//= require turbolinks
//= require bootstrap-sass/assets/javascripts/bootstrap-sprockets
:plus1:
:plus1:
@bosonnlp 后台如何自定义词组?
不知道具体情况,是编码错误。
# GB18030 -> UTF-8
rows = CSV.read('data.csv', 'rb:GB18030:UTF-8', headers: true, header_converters: :symbol, col_sep: ',' )
命名空间问题吧👙
localtunnel or ngrok
换 bower-rails
吧
今天的 topic 定下来没?
[20, 32, 32, 21, 30, 25, 29, 13, 14].sort[0..1]
# => [13, 24]
create_table :users, id: false do |t|
.....
class User < ActiveRecord::Base
self.primary_key = :username
.....
# 解决 ArgumentError::InvalidByteSequence 错误
gem 'rack-utf8_sanitizer'
可以和 @menghuanwd 交流下。
@xuxm687 “剑僧”在 406 室 :plus1:
module Utils
module MySQL
# 字段的备注字典
def column_comments
result = show_columns(self.column_names)
result.inject({}){|h, arr| h.merge(arr[0] => arr[8]) }.symbolize_keys
end
# 指定字段名的备注
def comment_of(field)
field = field.to_s
return "" unless self.column_names.include?(field)
result = show_columns(field)
result[0][8]
end
private
def show_columns(field)
condition_sql = if field.is_a?(Array)
"IN ('" + field.join("', '") + "')"
else
"= '#{field}'"
end
sql = "SHOW FULL COLUMNS FROM `#{self.table_name}` WHERE FIELD " << condition_sql
# 自行根据需求,进行修改
result = Rails.cache.fetch(sql) do
self.connection.execute(sql).to_a
end
end
end
end
unless ActiveRecord::Base.respond_to?(:column_comments)
ActiveRecord::Base.send :extend, Utils::MySQL
puts '_' * 88 + 'Utils::MySQL'
end
User.column_comments
#>
{
:id => '',
:username => '用户名'
}
User.comment_of(:username)
#> '用户名'