RubyOnRails杂记
include? ? ?in?
rand(3) 隨機數 0-2
flatten 數組扁平化
字符串字符迭代 ?each_byte ? 行迭代 ?each_line
define? a
begin rescure else ensure end
attr_reader attr_write attr_accessor
拼音排序(有遞歸)a.partition{ |x| x.is_a?String }.map(&:sort).flatten
methods
respond_to?
method_defined?
Time.now.strftime("%Y-%m-%d?%H:%M:%S")
ActiveRecord::Base.connection.exec_query(sql)
ActiveRecord::Base.connection.execute(sql)
object_id和equal?關注對象的identity
==和eql?關注對象的value
You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
安裝
gem update --system
gem install bundler
bundler update --bundler
卸載
gem uninstall bundler
rails plugin new xxx ?創建rails插件
rake install 或者 rails install 打包成gem
總結
以上是生活随笔為你收集整理的RubyOnRails杂记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java之移位运算符
- 下一篇: 数据结构1800题-错题集-第一章