RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: Darcbar
I think this can be resolved with default scopes? If you want your Picture to include :comments and your Spreadsheet to include :collaborators:
Picture
:comments
Spreadsheet
:collaborators
class Picture #model default_scope -> { includes(:comments).order('id DESC') } end class Spreadsheet #model default_scope -> { includes(:coolaborators).order('id DESC') } end
... and if you didn't want to include somewhere, use something like Picture.all.unscoped
Picture.all.unscoped
I think this can be resolved with default scopes? If you want your
Picture
to include:comments
and yourSpreadsheet
to include:collaborators
:... and if you didn't want to include somewhere, use something like
Picture.all.unscoped