association named error... rails3

7 views
Skip to first unread message

amvis

unread,
Feb 1, 2012, 7:56:45 AM2/1/12
to rubyonra...@googlegroups.com
ran =Transaction.select("transactions.id,customers.total_points").includes(:customers).where("transactions.customer_id=customers.id") 
 

after this i got the error like this...

Association named 'customers' was not found; perhaps you misspelled it? But the tables name is correct....

Valery Kvon

unread,
Feb 1, 2012, 8:14:38 AM2/1/12
to rubyonra...@googlegroups.com
what about association definitions?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aH-R-frrGAwJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Michael Pavling

unread,
Feb 1, 2012, 8:22:20 AM2/1/12
to rubyonra...@googlegroups.com
On 1 February 2012 12:56, amvis <vgrkr...@gmail.com> wrote:
> Transaction.select("transactions.id,customers.total_points").includes(:customers).where("transactions.customer_id=customers.id")

It may be that your include of customer needs to be singular:

ran=Transaction.select("transactions.id,customers.total_points").includes(:customer).where("transactions.customer_id=customers.id")

Reply all
Reply to author
Forward
0 new messages