It’s 11:00 pm; do you know where your model methods are?
February 23rd, 2008So the other day I was implementing what I considered a simple Rails association helper to make my life easier:
has_many :unapproved_posts,
:class_name => “Post”,
:finder_sql => “SELECT posts.* from posts ” +
”INNER JOIN users ON posts.user_id = users.id ” +
”INNER JOIN groups ON users.group_id = groups.id ” +
’WHERE (groups.id = #{id}) and ‘ +
’(posts.approved is [...]
