Вопрос

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