Rails 两种 where 查找,哪种更 Rails 风格一点?

caiqinghua · July 15, 2015 · Last by caiqinghua replied at July 16, 2015 · 2869 hits
@staffs = Staff.where(company: current_company)
@staffs = Staff.where(company_id: current_company.id)

这问题像脑筋急转弯

你们真会玩 😄

@huacnlee @rei 有没有注意到,主题贴中两个 @staffs 有像素级别的对齐问题,我不是处女座,我真的不是处女座的!

#5 楼 @lgn21st

media="screen"
.markdown code {
  margin: 2px;
}

好像是这里有问题

@staffs = Staff.where(company: current_company) @staffs = Staff.where(company_id: current_company.id)

@lgn21st @caiqinghua 明明是空格问题嘛 😄😄😄

#8 楼 @geekontheway 还真不是空格问题,一旦用 code 包住就会有问题,你看:

@staffs = Staff.where(company: current_company)
@staffs = Staff.where(company_id: current_company.id)

我保证这里边没有空格,但是还是会有问题

@staffs = Staff.where(company: current_company)
@staffs = Staff.where(company_id: current_company.id)

确实对不齐,我是摩羯座

@staffs = Staff.where(company: current_company)
@staffs = Staff.where(company_id: current_company.id)

真的对不齐诶

.markdown code 的 margin 去掉就 OK 了

<code> 默认 display: inline, 所以 margin 只对第一行有效... display: block 就可以了

#5 楼 @lgn21st #9 楼 @martin91 #11 楼 @winnie #12 楼 @messiahxu

我在 Windows 下,用 Chrom, FF, IE 都是齐的,只有 @lgn21st 的截图看着不齐。 修改代码了吗?

@peter 现在正常了

我本来是来看 LZ 的问题的 结果。。。

我也是醉了

这楼偏的哎,可怜的楼主。

You need to Sign in before reply, if you don't have an account, please Sign up first.