Note the single quotes!
Note the single quotes! Note the single quotes! Note the single quotes! It never ceases to amaze me how much there still is to discover in Rails. Using the raw finder_sql in has_many associations? Note the single quotes! Note the single quotes! Note the single quotes!
Also, read this post. If you are doing raw finder_sql like I am in a few places, you MUST use single quotes if you wish to retrieve the record ID in it.
Case in point: grabbing something from a User. :finder_sql => ’select bla where #{id}’
Note that I am using variable substitution in a single quoted string. Any Ruby developer will tell you that’s incorrect, where in this particular case it’s actually required to work! There’s some sort of ActiveRecord eval() magic going on.
No comments yet.