adding ruby tag to code blocks

This commit is contained in:
CodedBeardedSignedTaylor 2016-02-28 22:45:45 -05:00
parent 558769981e
commit 6a8da1f664

View File

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