#2 楼 @chaucerling 我试一试
#1 楼 @ripple 这个写法可以,但是复杂了,需要多行代码?
#1 楼 @liwei78 thx
在 User 添加如下代码:
class User < ActiveRecord::Base belongs_to :role, counter_cache: true def active_for_authentication? super && self.state == -1 end end
@fumesy 太感谢了,学习了,%>_<%