摘要:gem "pundit"Include Pundit in your application controller:class ApplicationController Headless policiesGiven there is a policy without a correspondi...
阅读全文
摘要:assert_select "div" foobarassert_select "div", "foobar" foobarassert_select "div.nav" foobarassert_select "div#profile" foobarassert_select "div[name=...
阅读全文
摘要:1.irb参数配置~/.irbrcIRB.conf[:PROMPT_MODE] = :SIMPLE #简化 irb 提示符,以及禁用一些烦人的自动缩进行为IRB.conf[:AUTO_INDENT_MODE] = false2.注释:#单行=begin......多行=end3.字符串字符串连接>...
阅读全文
摘要:API里面这样写reduce(initial, sym) → obj reduce(初始值,符号)reduce(sym) → obj reduce(符号)reduce(initial) { |memo, obj| block } → obj reduce(初始值){ |memo ...
阅读全文
摘要:1.2520 is the smallest nuber that can be diveded by each of the number from 1 to 10 without any remainder.what is the smallest positive number that is...
阅读全文
摘要:1.ruby中生成字符串有两种形式一种单引号,这种在使用时,对字符串不作处理,照原样输出双引号就不同了,他会查找字符串中需要替换的字符,例如\n,#{}这种都会先替换为需要的值。所以在使用的时候要注意是否有要用的值,尽可能多使用双引号。2.gets和gets.chomp()都表示读入用户的输入并用于...
阅读全文
摘要:Devise源于Warden,而warden是一个基于Rack的验证权限gem,不过,使用devise实际并不需要任何关于warden的知识。如果你之前有一些其他类似的维护验证权限功能的gem的使用经验的话,你会发现Devise的和他们的不同之处在于,提供了从页面到model的实现。相比而言,例如A...
阅读全文
摘要:1.由于网站无需验证,只需一封欢迎邮件,在config/intiailzers/devise.rb里面配置config.allow_unconfirmed_access_for = nil #2.days2.配置user--编辑app/models/user.rb文件,先写一下数据这一块class ...
阅读全文
摘要:登陆云端之后,发现报错如下:ssh root@47.88.0.215The authenticity of host '47.88.0.215 (47.88.0.215)' can't be established.ECDSA key fingerprint is 25:8a:5a:c8:c6:8e...
阅读全文
摘要:写这篇文章主要有两方面用途1.希望给rails同行一定的帮助,翻译水平有限,贴出中英文,翻译有误的地方欢迎指正,非常感谢,转载请标明出处,谢谢。2.加深作者对gem的理解,有需要更详细了解安装以及使用的朋友可以点击文章中的链接进入gem sources详细介绍。3.不定期更新一.mjackson/r...
阅读全文