I am really new to Rails, but I had some experience with sql, so right now I am really struggling with doing a simple thing in rails syntax.
So, there are two tables:
class WorkshopMetadata < ActiveRecord::Base
attr_accessible :uuid, :action
belongs_to :workshop
end
class Workshop < ActiveRecord::Base
has_many :workshop_metadatas
end
And the query I want to do is:
SELECT workshops.*
FROM workshops LEFT JOIN
(SELECT workshop_metadatas.workshop_id as id, workshop_metadatas.uuid
FROM workshop_metadatas WHERE uuid = 'smth') as metadatas
WHERE uuid IS NULL
I know that to do left join you have to use includes, but how do I include query, not the table? I am completely baffled by this.
Thank you!
P.S. And while we are at it, are there any good and comprehensive docs for rails? The one that are listing all the available arguments for includes method, for example.