diff --git a/docs/general/passing_arbitrary_options.md b/docs/general/passing_arbitrary_options.md index 523163d7..4039a12c 100644 --- a/docs/general/passing_arbitrary_options.md +++ b/docs/general/passing_arbitrary_options.md @@ -2,7 +2,7 @@ Let's say you have a basic Post Controller: -``` +```ruby class PostController < ApplicationController def dashboard render json: @posts @@ -12,7 +12,7 @@ end Odds are, your serializer will look something like this: -``` +```ruby class PostSerializer < ActiveModel::Serializer attributes :id, :title, :body end @@ -23,7 +23,7 @@ into the serializer. Here's what you would do: ### posts_controller.rb -``` +```ruby ... def dashboard render json: @posts, user_id: 12 @@ -33,7 +33,7 @@ into the serializer. Here's what you would do: ### posts_serializer.rb -``` +```ruby ... def comments_by_me Comments.where(user_id: instance_options[:user_id], post_id: object.id)