我无法将关联添加到某些现有代码。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)]'? –