支持一下
Rails 6.1 Activerecord 更新
https://github.com/rails/rails/blob/6-1-stable/activerecord/CHANGELOG.md
Named scope chain does no longer leak scope to class level querying methods.
class User < ActiveRecord::Base scope :david, -> { User.where(name: "David") } end
Before:
User.where(name: "John").david # SELECT * FROM users WHERE name = 'John' AND name = 'David'
After:
User.where(name: "John").david # SELECT * FROM users WHERE name = 'David'
where.not now generates NAND predicates instead of NOR. Before:
User.where.not(name: "Jon", role: "admin") # SELECT * FROM users WHERE name != 'Jon' AND role != 'admin'
After:
User.where.not(name: "Jon", role: "admin") # SELECT * FROM users WHERE NOT (name == 'Jon' AND role == 'admin')
以上两点,我看了一下 ruby-china 没有改相关的代码,怎么做到兼容的呢?
样式挺漂亮的
我也试了一下,2.1.4 版本的
2.1.4 :020 > Benchmark.measure { maxa(1000)}
=> #<Benchmark::Tms:0x007fda620f8798 @label="", @real=2.204469, @cstime=0.0, @cutime=0.0, @stime=0.0, @utime=2.1999999999999997, @total=2.1999999999999997>
2.1.4 :021 > Benchmark.measure { maxf(1000)}
=> #<Benchmark::Tms:0x007fda620ba290 @label="", @real=0.602247, @cstime=0.0, @cutime=0.0, @stime=0.0, @utime=0.6100000000000003, @total=0.6100000000000003>
貌似下面的要快几倍
还没有女朋友呢
我也发现了
可以在 config/application.rb 下设置
class Application < Rails::Application
config.action_view.sanitized_allowed_tags = ['table', 'tr', 'td'] #安全的标签
config.action_view.sanitized_allowed_attributes = ['id', 'class', 'style'] #安全的属性
end
详情可以看看这篇文章
多态的话,楼主是这个意思吗?
class Member < ActiveRecord::Base
# resource_id, int , 'demanders 或是 suppliers 的id'
# resource_type, string, 'Demander 或是 Supplier'
has_one :resource, :polymorphic => true
end
class Demander < Member
belongs_to :members, :as => :resource
end
class Supplier < Member
belongs_to :members, :as => :resource
end
我觉得单表继承也能实现你的需求
你这报错的 ruby 版本是用的 2.3.0 吗?
这个图真的笑死我了,情况就是这样的
楼主你好,有解决的吗?我也是同样的问题, External Libraries 里面是空的,只有ruby和bundler
rails s 可以启起来,rubymine 中运行就一直报 no rails found in SDK
感谢您的回复!这个我没试过,我觉得是 OK 的,比我上面解决方法方便太多了。
能啃老也是极好的
1、备份你的dpkg的status
sudo cp /var/lib/dpkg/status ~/backup/dpkg/
2、编辑status文件
sudo vim /var/lib/dpkg/status
3、查找你出问题的软件包,在本文中就是万恶的libgvc6-plugins-gtk, libgraphviz-dev, libmagickcore-6.q16-dev, libmagickwand-6.q16-dev
在vim中
/ldap-account-manager
[c-sharp] view plain copy
6474 Package: ldap-account-manager
6475 Status: deinstall reinstreq half-installed
6476 Priority: extra
6477 Section: web
6478 Installed-Size: 12268
6479 Maintainer: Roland Gruber <[email protected]>
6480 Architecture: all
6481 Version: 2.4.0-1
6482 Depends: php5 (>= 5.1), php5-ldap, apache | apache-ssl | apache-perl | apache2 | httpd, php-fpdf, debconf (>= 0.2.26) | debconf-2.0
6483 Suggests: ldap-server, php5-mcrypt, ldap-account-manager-lamdaemon, perl
6484 Conffiles:
6485 /etc/ldap-account-manager/shells newconffile
6486 /etc/ldap-account-manager/config.cfg newconffile
6487 /etc/ldap-account-manager/passwordMailTemplate.txt newconffile
6488 /etc/ldap-account-manager/apache.conf newconffile
6489 Description: webfrontend for managing accounts in an LDAP directory
6490 LDAP Account Manager (LAM) runs on an existing webserver.It manages user, group
6491 and host accounts. Currently LAM supports these account types:
6492 Samba 2 and 3, Unix, Kolab 2, address book entries, NIS mail
6493 aliases and MAC addresses. There is a tree viewer included to
6494 allow access to the raw LDAP attributes. You can use templates
6495 for account creation and use multiple configuration profiles.
6496 Account information can be exported as PDF file. There is also
6497 a script included which manages quotas and homedirectories.
6498 Homepage: http://lam.sourceforge.net/
4、全删除整个关于libgvc6-plugins-gtk, libgraphviz-dev, libmagickcore-6.q16-dev, libmagickwand-6.q16-dev,保存退出
5、保证格式
保证下一个package和上一个package中间有一行空行。
6、现在已经找不到llibgvc6-plugins-gtk, libgraphviz-dev, libmagickcore-6.q16-dev, libmagickwand-6.q16-dev包了,重新安装
用楼主的第一种和第二种方法
$ rvm install 2.4.3 --rubygems 2.7.6
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/16.04/x86_64/ruby-2.4.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /home/nie/.rvm/rubies/ruby-2.4.3, this may take a while depending on your cpu(s)...
ruby-2.4.3 - #downloading ruby-2.4.3, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 3 retries left.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 2 retries left.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 1 retries left.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: cache.ruby-lang.org
There was an error(6).
Checking fallback: https://ftp.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.bz2
No fallback URL could be found, try increasing timeout with:
echo "export rvm_max_time_flag=20" >> ~/.rvmrc
There has been an error fetching the ruby interpreter. Halting the installation.
好想要一本
+1
rm /var/lib/gems/2.3.0/cache/nokogiri-1.8.0.gem
gem install nokogiri 试一下这个咧
非常感谢,我已解决我的问题
sidekiq 是自己开好的另一个线程帮我们做异步队列的事情,还是需要我们手动开一个线程去做?然后把队列放在新开的线程下面跑,该怎么实现呢?