aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/README.md b/README.md
index c1bfe12b77..8f340d7013 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,11 @@ class MessagesController < ApplicationController
message.images.attach(params[:message][:images])
redirect_to message
end
+
+ def show
+ # Use the built-in with_attached_images scope to avoid N+1
+ @message = Message.find(params[:id]).with_attached_images
+ end
end
```