我無法將關聯添加到某些現有代碼。ActiveRecord查詢,添加內部連接,但獲取語法錯誤
這工作:
PropertySpa.joins(:spa_results, :country)
和這個作品:
PropertySpa.joins(:spa_results => [:comp_status])
但結合這一切讓我想不工作是什麼:
PropertySpa.joins(:spa_results => [:comp_status], :country)
給我的錯誤:
SyntaxError: (irb):18: syntax error, unexpected ')', expecting => from /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in
start' from /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in
start' from /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console ...
感謝您的任何幫助。
你可以試試'PropertySpa.joins([{:spa_results => [:comp_status]},:country)]'? –