Jbur43
Jbur43

Reputation: 1312

rails query interface joins argument error

I am trying to make use of Active Record Query Interface joins

https://guides.rubyonrails.org/v2.3.11/active_record_querying.html#using-arrayhash-of-named-associations

I have the associations for the two models working correctly, but when I try to run this query...

Package.all :joins => :drugs

I receive the:

ArgumentError: wrong number of arguments (given 1, expected 0)

does anyone know why this might be?

Upvotes: 0

Views: 37

Answers (1)

Dan Hilton
Dan Hilton

Reputation: 199

What version of Rails are you running? The documentation is pretty old (v2.3) and a lot has changed since then.

Try using Package.joins(:drugs).all instead.

Upvotes: 2

Related Questions