문제

When upgrading to Rail4, I changed conditions to where in the model but I'm now getting a syntax error ( syntax error, unexpected '}', expecting keyword_end)

has_many :businesses, through: :business_admins, { where business_admins: { state: 'accepted'} }
도움이 되었습니까?

해결책

Change it to this:

has_many :businesses, 
  -> { where(business_admins: { state: 'accepted'}) }, 
  through: :business_admins

Also see the Rails documentation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top