Ruby 更灵活,Java 更死板。 这两个特性各有好坏,看你们公司文化。
#35 楼 @ruby_xiaojie 也不算很早吧,现在很多人小学就开始玩了。 Fansub,查一下吧,不难。
好像从初中开始写程序以来就没怎么早睡过…… 后来跳了 fansub 的坑以后就更没救了……
但是业务逻辑代码能挣到钱,也能给公司带来价值。 公司发展总要你去编码的,不可能让你一直学新东西。
checking for stdint.h... *** extconf.rb failed ***
我觉得你还是自己 cd 进目录跑一下编译看看到底是哪步崩了。 目测和 1 楼的链接说的还不太一样。
@postids = posts.paginate(:page => params[:page]).order('created_at DESC').select('id').to_a
@posts = Post.where('posts.id' => @postids).order('posts.created_at DESC').eager_load [:user]
专门针对 MySQL 傻叉的分页效率做优化。
最常用的不是 map 么 _(:з」∠)_
新建一个 rails 5 项目,然后签入 git,再把 rails 4.x 项目覆盖上去,用 git diff 检查差异。
看上去目录结构差别并不大,应该很快能搞定。 最后跑一下集成测试,能过就行了。
首先,你 Ruby 的版本是?
#9 楼 @redemption 简单点说就是没必要。 如果 Rails 自己能保证外键约束,为什么还要多此一举让数据库去管外键呢? 再加上数据库的外键可能各个系统设计上会不同,甚至还会遇到不支持外键的数据库,总不能为这些数据库分别写几套适配器吧。
Also bundle install --path vendor/bundle
一向是用 rebase 的。从上游拉代码用 rebase,完成功能用 merge。
因为 children 的从属关系不是保存在主对象里的,而是保存在子对象里。 从 children 里剔除,只能经由 delete 这种方法。 否则你就得用事务。
Have you ever tried the simplest way?
{ |ch| ch == ch.downcase ? ch : ch + ch.downcase }
is almost 20% faster.
“Look at this figure…and then…you can see…someone sitting on the floor looking at a dot. On the floor. By themself. Now you don’t forget. Yeah.”
---- yukihiro_matz
诶?Open fire 是什么意思。
400k 别野贷款 30 年?也有点太低了吧…… 在美国好点的本科毕业应届生起步就能拿 100k/年,400k 别野 15 年怎么都能付清了……
[1] pry(main)> a = nil
=> nil
[2] pry(main)> not a.nil? and a.downcase
=> false
[3] pry(main)> not a.nil? and a.downcase == 'case'
=> false
[4] pry(main)>
从 Ruby2.3 开始你可以用单身狗运算符了。
a&.downcase == 'case'
帮你谷歌了一下。
不可以。