Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

michael-harrison's Profile

GitHub User: michael-harrison

Comments by

Avatar

Thanks Ryan for another great episode :)

Word of warning
When using the active_model_serializers gem make sure you override the options in the app controller as this gem will override all JSON rendering not just the ActiveModel you're looking to serialise. So use something like:

ruby
  def default_serializer_options
    { root: false }
  end

Without the above you will have a root node in all of your JSON rendering possibly breaking various client side javascript apps and WebService clients that consume the JSON.